Basic operations of the front-end database and the front-end database
* Directory [1] logon and exit [2] statement specification [3] Common commands [4] Before database operations
SQL is an ANSI standard computer language used to access and process databases. However, there are many different versions of SQL languages. To be compatible with ANSI (American National Standards Institute) standards, they must support some major keywords (such as SELECT, UPDATE, DELETE, INSERT, and WHERE) in a similar way)
RDBMS refers to a relational database management system. RDBMS is the foundation of SQL and also the basis of all modern database systems, such as Oracle, MySQL, and Access. Data in RDBMS is stored in database objects called tables. A table is a collection of related data items. It consists of columns and rows.
The following describes basic mysql database operations.
Log on and exit
The first step in database operations is to log on to the database. A MySQL user name and password are usually required. If the server runs on a machine other than the login server, you must specify the Host Name
Parameter description-D (database) Open the specified database-h (host) server name-p (password) password-P (port) port number-u (user) user Name-V (version) output version information and exit
Mysql database exits in three ways: exit;, quit;, and \ q ;. Select either of them.
Statement Specification
Before operating the database, you must first understand the database statement specifications, which mainly include the following three
1. All keywords and function names are capitalized
2. The database name, table name, and field name are all in lowercase.
3. the SQL statement must end with a semicolon
Common commands
The mysql database has the following common commands:
Select version (); displays the current server version select now (); displays the current date and time select user (); displays the current USER
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 selecting and using it. You must perform operations explicitly. Therefore, the second step of database operations is to select a database.
USE db_name
Next, let's view the Database List under the server
SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr]
Sometimes, we need to modify the database
ALTER {DATABASE | SCHEMA} [db_name] [DEFAULT] CHARACTER SET [=] charset_name
Finally, delete the database.
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name
View the Database List under the server