Add to the deletion of SQL statements, so practical, I would like to briefly introduce its simple usage.
1. What is SQL?
SQL is a computer language that is used to access and manipulate the database's standards.
What can 2.SQL do?
(1) Queries can be made to the database
(2) data can be inserted into the database
(3) You can update the data in the database
(4) You can delete data from a database
(5) New data can be added to the database
PS: Total can be broadly divided into increase, delete, change, check
3. How do I write the SQL language?
Now the main programming SQL Language tool is SQL Server, published by Microsoft, because the database update is cumbersome, so the most current use of SQL Server 2008, and finally use the above or the following statements for editing.
4.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.
(1) The Query and update Directives form the DML portion of SQL:
1) select-fetching data from database tables
2) update-update the data in the database table?
3) delete-Delete data from the database table?
4) Insert into-inserts data into the database table
Now I'm going to bring you the long-awaited statement (code) I hope to help you.
1.SQL Select syntax
Select from The table name is written as follows: Select from Student
2.where clause:
Grammar:
Select from from column name operator value
Operator:
= equals
> Greater than
< less than
<> Not equal to
>=/<= greater than or equal to/less than equals
PS: In other versions does not equal can be written as:! =
Use:
Select from where ' Beijing '
PS: When the condition is a string, enclose it in single quotes, and the number is not required.
3.order by statement:
Order BY is an ascending/descending sort of the specified column
Ascending ASC
Descending desc
Ascending syntax:
Select from Student ORDER BY Student ASC
Descending syntax:
Select from desc
4.insert into statement:
Used to insert new rows/data into a table
Grammar:
Insert into table name (value 1, value 2, value 3 ...) Values (value 1, value 2, value 3, ...) )
5.update statement:
Used to modify the data in a table.
Grammar:
Set where column name = value to modify
6. Delete the statement:
1. Use the delete DELETE statement:
from where column name = ' Zhang Yida '
PS: When you use DELETE to delete a statement, you must use the WHERE statement .
2. Delete the statement using the TRUNCATE TABLE:
TRUNCATE TABLE name
PS: When using TRUNCATE TABLE, do not follow the WHERE statement.
The difference: TRUNCATE TABLE is to delete the specified data in the table, but the structure of the table, columns, constraints, indexes, etc. will not be changed, delete will not leave the log file, can not be restored repair, delete may produce log files, easy to restore and restore.
I hope the above is helpful to everyone.
SQL statement base increase and deletion check