Website construction tutorial (7): SQL Elementary tutorial _ MySQL

Source: Internet
Author: User
Website construction tutorial (7): SQL Elementary tutorial tip: SQL is a standard computer language for accessing and processing databases.


SQL is a standard computer language used to access and process databases.

Use SQL to manage data
Structured Query Language (SQL) is a standard language used to Access databases, including SQL Server, Oracle, MySQL, Sybase, and Access.

For those who want to store data in the database and obtain data from it, the knowledge of SQL cannot be measured.

What is SQL?
Structured Query Language)
SQL enables us to access databases
SQL is an ANSI standard computer language.
SQL queries for databases
SQL can retrieve data from the database
SQL can insert new records in the database
SQL can delete records from the database
SQL is easy to learn
Editor's note: ANSI, United States Organization for Standardization

SQL is a standard-...
SQL is an ANSI standard computer language used to access and operate database systems. SQL statements are used to retrieve and update data in the database. SQL works with database programs such as MS Access, DB2, Informix, ms SQL Server, Oracle, Sybase, and other database systems.

Unfortunately, there are many different versions of SQL languages, but to be compatible with the ANSI standard, they must support some major keywords in a similar way (such as SELECT, UPDATE, DELETE, INSERT, WHERE, and so on ).

Note: apart from SQL standards, most SQL database programs have their own private extensions!

SQL database table
A database usually contains one or more tables. Each table is identified by a name (for example, "customer" or "order "). A table contains records (rows) with data ).

The following example shows a table named "Persons:

LastName FirstName Address City
Hansen Ola Timoteivn 10 Sandnes
Svendson Tove Borgvn 23 Sandnes
Pettersen Kari Storgt 20 Stavanger

The table above contains three Records (each corresponding to a person) and four columns (surname, name, address, and city ).

SQL query program
Through SQL, we can query a database and obtain a returned result set.

The query program is similar to the following:

SELECT LastName FROM Persons result set is similar to this:

LastName
Hansen
Svendson
Pettersen

Note: Certain database systems require the use of semicolons at the end of SQL commands. Do not use semicolons in our tutorial.

SQL data operation language (DML)
SQL (Structured Query Language) is the syntax used to execute queries. However, the SQL language also contains the syntax used to update, insert, and delete records.

These query and update statements come from the SQL DML section:

SELECT-obtain data from a database table
UPDATE-UPDATE data in the database table
DELETE-DELETE data from a database table
Insert into-INSERT data to a database table
SQL Data Definition Language (DDL)
The data definition language section of SQL enables us to create or delete tables. We can also define indexes (keys), define links between tables, and apply constraints between tables.

The most important DDL statements in SQL:

Create table-CREATE a new TABLE
Alter table-change database TABLE
Drop table-delete a TABLE
Create index-create index (search key)
Drop index-delete an INDEX

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.