The Most Fundmental SQL Commands
SQL stands for Structured Query Langauge. It is the standardized programming language for relational databases.
In order to learn relational databases, you need to learn SQL first. The most basic SQL commands are CRUD which stands for Create, Read, Update and Delete.
-
The typical CREATE commands examples:
CREATE DATABASE test
create a database named
test
CREATE TABLE one (id INT, name VARCHAR(20), age INT, gender CHAR(1))
create a table
CREATE USER 'xiaoming'@'localhost' identified by '123'
create a new user and password
-
The typical READ commands examples:
SELECT * FROM one
select everything from table
one
SELECT * FROM one ORDER BY id DESC
select everything from table
one
by descending order
SELECT * FROM one WHERE id = 1
select the record whose id is
1
from tableone
SELECT * FROM one WHERE name LIKE 'xi%'
select the records whose name begins with
xi
from tableone
-
The typical UPDATE command example:
UPDATE one SET name = 'xiaohong' WHERE id = 1
change the name of the record with id
1
toxiaohong
-
The typical DELETE commands examples:
DELETE * FROM one
delete everything from table
one
DELETE * FROM one WHERE id =2
delete the record with id = 2 from table
one
The above basic SQL commands are fundamental commands and are the basics for programming database web pages and applications.
There are plenty of SQL books out there. You can just grab one and it should serve your needs.