Introduction to SQL language
(1) A database is a file system that operates on a database using standard SQL
* Standard SQL, the use of statements in MySQL, in Oracle, DB2 can use this statement
(2) What is SQL
* Structured Query Language, structured querying language, operation of the database
* SQL non-procedural language, no need to rely on other conditions to run
* * Like in Java
if (a > 5) {
System.out .....
}
(3) Classification of SQL
First class: DDL (data definition language)
* CREATE DATABASE, CREATE database table
* Common Statement Create
Type II: DML (Data manipulation language)
* Increase the number of records in the table modify the delete operation
* Frequently used statements Insert Update Delete
Category III: DCL (Data Control Language)
* The programming language of the database
Class Fourth: DQL (data Query Language)
* Operations on queries in tables
* Frequently Used statements Select
* The main content of the study: Use SQL language to make a pruning (crud) operation on a database, a database table, and a record in a table
Using SQL for database operations
(1) Connect to the database
* Open cmd window, use command, connect MySQL database
* Command: mysql-u root-p password
(2) Create a database
* Statement: Name of the CREATE database;
* * Example: CREATE DATABASE testdb1;
(3) View all databases
* Statement: show databases;
(4) Deleting a database
* Statement: DROP database name to delete;
* * Example: drop database testdb1;
(5) Switch database
* If you want to create a database table, this table will be in a database, so you need to switch to the database
* Statement: Use the name of the database to switch;
* * Example: use TESTDB2;
SQL database Simple operation