Simple understanding of SQL (Structured Query language)

Source: Internet
Author: User

Simple understanding of SQL (Structured Query language)

Structured Query Language (English:Structural Query Language, abbreviation:SQL), is a special purpose programming language for the standard data query language in the database,IBMThe company was first used in the database system it developed. 1986yearsTenThe American National Standards InstituteSQLas a standard language for the relational database management system (ANSI X3.135-1986),1987International standards organization, with support from However, in the course of practice, all kinds of database systems areSQLsome modifications and expansions are made in the specification. So, in fact, the difference between different database systemsSQLcannot be completely common to each other. [ wikipedia]

SQLis a high-level, non-procedural programming language that allows users to work on high-level data structures. It does not require the user to specify how to store the data, nor does it require the user to understand how the data is stored. And its interface, can make the bottom structure of a completely different database system and different databases, the use of the sameSQLas input and management of data. It to record items (Records) in a collection (Set) (item set,Record Set) as a manipulation object, allSQLA statement accepts an item set as input, and the set of items that are submitted back as output, which allows aSQLthe output of the statement as anotherSQLthe input of the statement, soSQLstatements can be nested, which gives it a great deal of flexibility and powerful functionality. In most cases, a single event that requires a large segment of the program to be practiced in other programming languages isSQLOnly one statement is required to be expressed. This also means usingSQLyou can write very complex statements. [ wikipedia]

SQL Category:

    • Data Query Language (DQL)
    • Data definition language (DDL)
    • Data manipulation Language (DML)
    • Data Control Language (DCL)
1. Data Query Language (DQL)

The Data Query Language (Language, DQL) is the most basic SQL statement in the SQL language, which is responsible for querying the data without modifying the data itself.

Syntax structure:

SELECT [ linked fields bits to be extracted, or "*" for all linked fields bits ]

< Strong>from [ -- can be paired with join Do a relational connection.

WHERE [ extracted discard ] -WHERE can be no .

GROUP by [ to do the total group linked fields bit ] --GROUP by you must have it when you use the instructions.

having [ to be a linked fields bit ] -- to use the total function as a condition

ORDER by [ Linked fields bits and directions to sort ] --ORDER by But there is no, if not, according to the search engine output sequence for the Lord.

2. Data definition language (DDL)

The Data definition language (Language, DDL) is a set of SQL languages that is responsible for the definition of data structures and database objects, consisting of the Create, alter, and drop three grammars, which were originally created by Codasyl ( Conference on the data Systems Languages) is now included as a subset of the SQL directives.

Syntax structure:

CREATE

Create can be used for creating users, databases, data tables, views, stored procedures, stored functions, triggers, indexes, and so on.

Alter is the instruction that is responsible for modifying the database object.

Drop is the instruction to delete the database object, just specify the name of the database object you want to delete.

3. Data manipulation Language (DML)

Data manipulation language (manipulation Language, DML) is a set of instructions in the SQL language that is responsible for running data access to database objects, with the INSERT, UPDATE, delete three directives as the core, representing inserts, updates, and deletions, respectively.

Syntax structure:

Insert is a directive that inserts data into a database object, a database object that can insert data in a data table, and an updatable view table.

The update instruction updates the data in the data table of the matching criteria to a new value, given the criteria.

Delete is the instruction to delete data for the database object.

4. Data Control Language (DCL)

Data Control Language, in the SQL language, is an instruction that controls access to data that controls the control of a particular user account against database objects such as data tables, view tables, stored procedures, user-defined functions, and so on. Consists of two instructions from GRANT and REVOKE.

The DCL controls the user's access rights, grant is the authorization statement, and the corresponding REVOKE is the REVOKE authorization statement.

Simple understanding of SQL (Structured Query language)

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.