Using the SQL Sever language for database operations
Common keywords
Identity self-growth
Primary KEY Primary Key
Unique Uniqueness Key
Not NULL non-null
References foreign key (reference)
When using the query operations database, you need to set up a database that requires operations to avoid errors
1. Delete a table
DROP table Name
2, modify the table
ALTER TABLE name add column name data type---Append
ALTER TABLE table name drop column name
Crud Operation ☆★☆
Create Add data
Read reading data
Update modifies data
Delete Deletes data
1. Add Data
Insert into table name value (' ' ', ') has several columns plus a few columns that cannot be omitted
Insert into table name (column name, column name 2) value ("', '"), which column is added after the list name
If the first column in SQL Server is a self-growing column, the first column can be omitted when adding
Other databases need to be left blank
2. Delete data
The delete from table name is logically feasible, and running delete deletes all data, which is prohibited when actually used.
Delete from table name where ids=5 delete ids=5 this line
3. Modify the data
Update table name set fcode= ' p016 ' modifies all fcode data
Update table name set fcode= ' p016 ' where ids=6 modify ids=5 fcode data
Update table name set fcode= ' p016 ', mcode= ' P002 ' where ids=6
In SQL, Boolean data also needs to be enclosed in single quotes
SQL Server database (SQL Sever language CRUD)