SQL PRIMARY KEY Constraint
Primary key must be unique, primary key column cannot be null
Each table should have a primary key, and each table can have only one primary key
Foreigh KEY to learn
Create a table
Create Table TableName
(
Id int not NULL Primary key,
Name varchar (255) is not NULL,
Tell varchar (255),
ADD varchar (255)
)
Increase:
Insert into TableName (column 1, column 2) VALUES (value1,value2)
INSERT into tableName values (value1,value2, must match table column count)
Delete:
Delete from tableName where Id = 1 Delete the content of the table that matches the condition, you can rollback,dml the language
Truncate Table TableName Delete the contents of the tables, the table still exists, faster than delete. Unable to Rollback,ddl language
drop table TableName Delete entire table
DDL (data definition Language) Definition language
DML (data manipulation Language) operation language
Modify:
Update tableName Set Column 1 = Value1, column 2 = Value2: where column 3 = Value3
Inquire:
Select column 1 newName1, column 2 newName2 from XXXX where xxxx
SQL Server some basic commands