SQL language basics

Source: Internet
Author: User

When I watched the database video, I once talked about the content of the SQL language. I sorted it out below

Standard SQL contains nine statements.

 

Data Query

Select

Data Definition

Create, drop, alter

Data manipulation

Insert, update, delete

Data Control

Grant, revoke

 

The SQL language can be divided into four categories:

Category Function Example
Data Definition Language (DDL) Defines the data structure and creates, modifies, and deletes database objects.

Create Table: Create a database table

Drop index: Delete the table index.

Alter table: Add a table column, redefine the table column, and change the storage allocation.

Data manipulation language (DML) Allows you to insert or update data in the database.

Insert: add data rows to the table

Select: Retrieves data rows.

Delete: delete data rows.

Update: Change Data

Data Control Language (DCL) Used to specify various permissions of database users

GRANT: grant permissions or roles to users or other roles

Revoke: revoke permissions from a user or database role

Database Transaction Control Language To ensure database integrity

Commit work: Write the changes made by the current firm to the disk.

Rollback: invalidate all changes since the last submission

In addition, pay special attention to code specifications when writing SQL statements.

Basic SQL statement Syntax:

1. Each statement must end with a semicolon.

2. Free writing. You can use SQL statements to write a single row (long rows are not recommended) or separate them into several rows.

3. It is case-insensitive. keywords, table names, and column names can be case-insensitive, but the content of columns is case-sensitive.

 

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.