SQL is a standard
ANSI SQL is a standard (American National Standards Institute - National Institute of Standards United States) about publishing the database system. SQL statements are used to retrieve and update data in a database.
SQL works with most database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase etc ..
Note: Most programs have SQL database support for SQL extensions only work with the program itself.
Table Database
A database often includes one or more tables (table). Each table is identified by a name (eg, Customers or Orders). Tables contain records - line (record - row), the data of the table.
Here is an example of a table called Persons (people):
LastName FirstName Address City Hansen Ola Tove Svendson Timoteivn 10 Borgvn 23 Sandnes Sandnes Pettersen Kari Storgt 20 Stavanger
The table above includes 3 items (rows), each record corresponds to a person, and four columns (LastName, FirstName, Address, and City).
The SQL query
With SQL query we can database and have a result set returned by the query.
A query as follows:
SELECT LastName FROM Persons
Will return the following results:
LastName Hansen Svendson Pettersen
Note: Some database systems require statements SQL must end with a semicolon (;). We will not use the semicolon in this article.
SQL data manipulation language (DML - Data Manipulation Language)
SQL syntax to execute the query. SQL also includes a syntax to update - modify, add and delete records.
The following is a list of commands and query types of SQL DML:
SELECT - retrieve data from a database table.
UPDATE - update / modify data in the table.
DELETE - delete data in the table.
INSERT INTO - adding new data to the table.
SQL data definition language (DDL - Data Definition Language)
section of SQL DDL allows the creation or delete the table. We can also define indexes (keys), indexes (index), specify the links between the tables and establish binding relationships between tables in the database.
The most important DDL statements in SQL are :
CREATE TABLE - create a new table.
ALTER TABLE - change the structure of the table.
DROP TABLE - remove a table.
CREATE INDEX - creates an index (search keywords - search key).
DROP INDEX - remove the index has created.
đang được dịch, vui lòng đợi..
