SQL Server database (SQL Sever language CRUD)

Source: Internet
Author: User

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)

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.