Query: Right-click on the first 1000 rows of a new table selection query
Backup data: Database name Right-click, there is a task, go to the inside of the backup, (backup copy has a time, from the inside design time), copy only the backup that hit a √, click OK, it's done
The file that ends with. bak is the backup file for the database.
Detach: There's a separation in the right button.
Attach: Right click on the database, attach, find the address of the file placed on the computer, click OK, add the database (additional suffix is. mdf file)
New query
Code creation database Create DB Ssdata
Ctrl+s is saved: saved in document by default
--Comments, one line
/**/representative notes a paragraph
Go play the role of cohesion, can write not write
Use represents the name of the database that is directly written after the database is selected
Drop Database Ssdata Delete databases
CREATE TABLE student ()
The code represents the column name int not NULL, (the NOT NULL means cannot be empty, separated by ",")
The last column of "," can be omitted
The DBO represents the system architecture
ALTER TABLE student Add sex int (modify table, add column)
--Modify Table Delete column
ALTER TABLE student drop column sex
--Delete the entire table
DROP TABLE Student
--inserting data into a table (insert only one piece of data at a time)
INSERT into student values (1, ' Zhang San ', 1990-09-22)
Querying all data in a table
Select *from Student
--Modify data
Update student Set birthday = ' 1990-09-09 '
--Delete data
Delete from student
Delete from student where name= "Harry"
Create: Creation, creation, production
Table: Tables
Alter: Change, change
Sex: Identifying and distinguishing
Select: Query, find
Update: updating, modernizing, correcting, correcting
From: Where
Insert: Inserting, embedding
Delete: Remove
Drop: Terminate
Primary key and foreign key
Primary key: Is an index, help us quickly find, in the database to take out a column as the primary key, data is the only non-repeatable data can not be empty data, slowing down the new data
Right-click Table, point design, right-click column, set as primary key
Primary KEY Key Key
Identity (+)
Identity specification (is identity) identity seed (set int type)
Querying, backing up data, creating a database