SQL Basic Statement

Source: Internet
Author: User

Add Insert Delete Delete change update check Select

Update change alter

Creating a Database Create db

See how many databases show databases

Using the database Use DB

Delete Database Drop db

CREATE TABLE table name (column name data type [NOT NULL] [primary key], column name data type [NOT NULL],..)

View all tables Show tables

View a table data select * FROM table name * represents all columns also can select Column name from table name

DROP table Name

Change table name rename table name to new table name

Modify table content modify Data Update table name set column name = value, column name = value ... where column name = value

Add Table content Insert data inserts into table name (column name, column name ...) Values (value, value ...) )

Modify a record in a column Update table name set column = value where column = value

Delete a record in a column delete from table name where column = value

Add a column Alter table name add column name data type

Remove a column Alter table name drop column name

Modify a column name sp_rename ' table name, original column name ', ' new column name ', ' column ' Note: The new column name does not precede the table name, otherwise, the changed column name is: Table name. NEW Column Name

Desc Descending sort

ASC Ascending order

Delete delete record structure still exists that can also be found after execution has a commit process

Drop structure and data are removed one-step operation completed

SQL Basic Statement

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.