What is SQL (pronounced "sequel")?
SQL full name is Structured Query Language (Structured Query language), which is the standard computer language for accessing and working with databases. A tool or interface that is used to access and manipulate a database. By using the SQL language, you can help include database creation, database or table deletion, fetching row data, and modifying some data, making it easier to access and manipulate data.
What can SQL do?
SQL can create new databases and their objects (tables, indexes, views, stored procedures, functions, triggers);
SQL can modify the structure of an existing database;
SQL can delete objects from the database;
SQL can ... A lot.
Using SQL, you need ...
1. An RDBMS database program (such as Ms Access,sql Server,mysql).
2. Use the server-side scripting language (such as PHP or ASP).
Rdbms
relational database Management system: relational databases management systems.
Data in an RDBMS is stored in a database object called a table .
Table
A table is a collection of related data items that consists of columns and rows.
code example:
SELECT * from Customers;
Each table is decomposed into a smaller entity called a field . A field is a column in a table that maintains specific information about each record in a table and is a vertical entity in a table.
A record is each individual entry that exists in a table and is a horizontal entity in a table.
SQL syntax rules
1.SQL statements always start with a keyword;
The 2.SQL statement is always a semicolon ";" End
3.SQL is case insensitive.
Some of the most important SQL commands
select-extracting data from a database
update-updating data in a database
delete-deleting data from the database
Insert into-inserting data into the database
Create database-creating a new database
Alter database-Modify the database
Create table-creating a new table
Alter table-modify a database table
Drop table-Delete Table
Create index-Index
Drop index-Delete Index
Simple syntax for various statements
SELECT statement
SELECT from table_name
SELECT statement and where statement
SELECT [*] from [Table Name] WHERE [condition 1]
SELECT statement with where and/or clauses
SELECT [*] from [Table Name] WHERE [condition 1] [and [OR][condition 2]...
SELECT Statement and ORDER BY
SELECT column_name () from table_name ORDER by ASC or DESC
INSERT into statement
INSERT into table_name (column ,column1, column2,column3 ...) VALUES 1 2 3...)
UPDATE statement
UPDATE table_name SET column = column 1 = 1 ,... WHERE some Column =some Value
DELETE statement
DELETE from table_name WHERE some Column = some Value
Learn SQL (Introduction)