Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

SQL Notes

SQL (Structured Query Language) is a standard programming language for managing relational databases, structured in tables with rows and columns. It includes DDL (Data Definition Language) for defining database structures and DML (Data Manipulation Language) for managing data, with key commands such as CREATE, INSERT, UPDATE, and DELETE. Common SQL operations include retrieving, adding, modifying, and deleting data within the database.

Uploaded by

Viswa Suren
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL Notes

SQL (Structured Query Language) is a standard programming language for managing relational databases, structured in tables with rows and columns. It includes DDL (Data Definition Language) for defining database structures and DML (Data Manipulation Language) for managing data, with key commands such as CREATE, INSERT, UPDATE, and DELETE. Common SQL operations include retrieving, adding, modifying, and deleting data within the database.

Uploaded by

Viswa Suren
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL (Structured Query Language) is a standard programming language used to manage and manipulate

relational databases. Here is a basic overview of SQL and common queries you can use:

1. Database Structure:

A relational database is structured in tables, which consist of rows and columns. Each table represents an
entity (e.g., customers, orders) and each column represents an attribute (e.g., name, price).

In the context of databases, DDL (Data Definition Language) and DML (Data Manipulation Language) are
two categories of SQL commands used to interact with the database. Here's a breakdown of each:

1.1.DDL (Data Definition Language)

DDL is used to define and modify the structure of a database, including creating, altering, and dropping
database objects such as tables, indexes, views, and relationships.

- CREATE: Creates a new database object, such as a table or index.


- ALTER: Modifies the structure of an existing database object.
- DROP: Deletes a database object.
- TRUNCATE: Deletes all rows from a table and resets identity columns.

DML (Data Manipulation Language)

DML is used to manage and manipulate data within a database, including inserting, updating, and
deleting data.

- INSERT: Adds new rows to a table.


- UPDATE: Modifies existing data in a table.
- DELETE: Deletes rows from a table.

Key differences between DDL and DML

- Purpose: DDL is used for defining and modifying database structure, while DML is used for
managing and manipulating data.
- Commands: DDL uses commands like CREATE, ALTER, and DROP, while DML uses commands like
INSERT, UPDATE, and DELETE.
- Impact: DDL changes the database schema, while DML changes the data within the database.
2. Basic SQL Operations:

The most common SQL operations are:

 SELECT: Retrieves data from a database.

 INSERT: Adds new data into a table.

 UPDATE: Modifies existing data.

 DELETE: Removes data from a table.

 CREATE: Creates a new database, table, or other objects.

 ALTER: Modifies the structure of an existing database object.

 DROP: Deletes a database object (e.g., table or column).

You might also like