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 can work with database programs, such as MySQL, 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!
The SQL language provides the following functions:
- Database-oriented Query
- Data can be retrieved from the database.
- New records can be inserted into the database.
- Updatable database data
- Records can be deleted from the database.
- You can create a new database.
- You can create a new table in the database.
- You can create a stored procedure in a database.
- You can create a view in the database.
- You can set permissions for tables, stored procedures, and views.
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 ).
SQL statements are generally in upper case (but not case sensitive) and end with ";", for example:
SELECT * FROM linuxcast_course;Common SQL statements are classified into the following categories:
- Data Definition Language (DDL)
- Data Manipulation Language (DML)
- Data Control Language (DCL)
- Transaction Control (TCL)
The most common DML statements in SQL:
1. SELECT-get data from the database table 2. UPDATE-UPDATE data in the database table 3. DELETE-DELETE data from the database table 4. insert into-INSERT data INTO the database table
The most common DDL statements in SQL:
1. create database-CREATE a new DATABASE 2. alter database-modify DATABASE 3. create table-CREATE a new TABLE 4. alter table-change database TABLE 5. drop table-delete TABLE 6. create index-create index (search key) 7. drop index-delete an INDEX