1. SQL DML and DDL
SQL can be divided into two parts: Data manipulation Language (DML) and data definition language (DDL).
SQL (Structured Query language) is the syntax for executing queries. However, the SQL language also contains syntax for updating, inserting, and deleting records.
The query and update Directives form the DML portion of SQL:
SELECT-Get data from a database table
Update-updating data in a database table
Delete-Deletes data from the database table
INSERT into-inserts data into a database table
The Data definition language (DDL) portion of SQL gives us the ability to create or delete tables. We can also define indexes (keys), specify links between tables, and impose constraints between tables.
The most important DDL statement in SQL:
Create database-Creating new databases
ALTER DATABASE-Modify databases
CREATE table-Creates a new table
ALTER TABLE-Change (change) database table
drop table-Delete tables
Create index-Creating indexes (search key)
Drop INDEX-Delete indexes
dbo. Personnel Management (empty)
2. INSERT into statement (increment)
The INSERT INTO statement is used to insert a new row into the table.
Syntax: (which table (which columns) to insert, and what the value is)
All columns insert into table name values (value 1, value 2,....)
Specify column insert into table name (column 1, column 2,...) Values (value 1, value 2,....)
Insert into Values (' Fu Xianyao 'xiany.fu') -- increase
INSERT INTO dbo. People management values (' Zengjianing ', ' Jn.zeng ', 23)
Add two rows
3. SQL UPDATE Statement (change)
The Update statement is used to modify the data in the table.
Syntax: (update which table, set a column = new value at column = value)
UPDATE table name SET column name = new value WHERE Column name = value
Update Set name =' Wang Xiaoyao 'where name =' Fu Xianyao ' -- Modify
Change
4. SQL DELETE statement (delete)
The DELETE statement is used to delete rows in a table.
Syntax: (a row that removes a column name = value from a table)
DELETE from table name WHERE column name = value
Delete from table name--delete all rows in the table
Delete from where name =' Zengjianing ' -- Delete
Delete
5. SQL SELECT statement (check)
Select statements are used to select data from a table. The result is stored in a result table, called a result set.
Syntax: (select which columns are selected from the table)
SELECT column name from table name
SELECT * FROM table name--Select all columns from the table
Select * from dbo. People management -- Find
Basic SQL Tutorial--implement and delete the function (W3school)