SQL Server some basic commands

Source: Internet
Author: User
Tags sql primary key

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.