Get the App
SLTechnology News&Howtos  ›  Database  › 

Notes on learning mysql: ten basic introductory sentences of mysql

Shulou Source: shulou.com Published: 2022-06-01 11:01:10 11月13日 Update

Learn about mysql databases, starting with the ten simplest entry statements. At the beginning of learning mysql, the teacher asked us to enter statements using the cmd console instead of using tools, so that we could be familiar with mysql statements first.

The first step is to enter mysql with the following statement: mysql-hlocalhost-uroot-p, then press enter and enter the password.

C:\ Users\ Administrator > mysql-hlocalhost-uroot-p

Enter password: *

If you successfully enter, there will be Welcome to the MySQL monitor. Wait for the hint, and then you can operate.

The first statement is to see which databases are in the current database server:

Show databases

Note: do not delete the basic database that comes with the database itself, or there will be a lot of trouble!

The second statement is to create the database:

Create database library name

The third statement is to delete the database:

Drop database library name

Article 4 is that the database cannot be modified.

Article 5 is to select the database:

Use library name

Only this item can be used without a semicolon. To use the database table, you have to select the database first.

Article 6 is to view the database tables (there are no tables in the database you just created):

Show tables

Article 7 is to create a database table:

Create table table name (column 1 type, column 2 type, column 3 type)

Article 8 is to view the table structure:

Desc (describe) table name

Clause 9 is to change the table name:

Rename table original table name to new table name

Article 10 is to delete the table:

Drop table table name

These ten sentences as the most basic entry sentences, learning mysql must be remembered and proficient!

Tags: Data database statement learning type input selection proficiency success thing semicolon only password tool console server structure teacher this is trouble Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info Docker MariaDB Xiaomi