Show Table of ContentsDirectory[1] Login exit [2] statement specification [3] Common commands [4] database operationsPrevious words
SQL is a standard computer language that is used to access and process databases in ANSI. However, there are many different versions of the SQL language, and in order to be compatible with ANSI (American National Standards Institute) standards, they must collectively support some key keywords (such as SELECT, UPDATE, DELETE, INSERT, where, etc.) in a similar way
RDBMS refers to relational database management systems, which are the basis of SQL and are also the foundation of all modern database systems, such as Oracle, MySQL, and access. Data in an RDBMS is stored in a database object called a table (tables). A table is a collection of related data items that consists of columns and rows
The basic operations of the MySQL database are described below
Sign Out
The first step in manipulating the database is to log in to the database, typically providing a MySQL username and password. If the server is running on a machine other than the logon server, you also need to specify the host name
[note] After exiting the database, CMD clears the screen by entering the CLS (equivalent to clear screens)
Parameter description-D (database) Open the specified database-h (host) server name-p (password) password-p (port) port number-u (user) Username-V (version) output release information and exit
MySQL database exit There are three ways, namely exit; quit; \q;. Choose one of the following
Statement specification
Before operating the database, you should first understand the statement specification of the database, the following three main
1. keyword and function name all uppercase
2. Database name, table name, field name all lowercase
3. The SQL statement must end with a semicolon
Common commands
The MySQL database has the following three common commands
SELECT VERSION (); Displays the current server version select Now (); Displays the current date time select USER (); Show Current User
[note] Use the Delemiter statement to modify the Terminator
The//// terminator is a dot delemiter.
Database operations
The first step in database operations is to create a database
CREATE {DATABASE | SCHEMA} [IF not EXISTS] db_name [DEFAULT] CHARACTER SET [=] Charset_name
Creating a database does not mean that it is selected and used and must be explicitly manipulated, so the second step in database operations is to select the database
Use Db_name
Below, let's look at the list of databases under the server
'pattern
Sometimes we need to modify the database
ALTER {DATABASE | SCHEMA} [Db_name] [DEFAULT] CHARACTER SET [=] Charset_name
Finally, the operation to delete the database
DROP {DATABASE | SCHEMA} [IF EXISTS] Db_name
Then look at the list of databases under the server
Base operation of the front-end learning Database