MySQL's common commands

Benefits ## Database
1. persistent data to the local
2. Structured Query can be achieved, easy to manage


## database concepts
1, DB: a database, save a set of organized data container
2, DBMS: database management system, also known database software (product), for managing data in the DB
3, SQL: Structured language query language for communication and DBMS

Features database ## stores data
1, the data into a table, and then put into a library table
2, a database can have multiple tables, each table has a name, to identify themselves. Table names must be unique.
3, the table having a number of characteristics that define how the data is stored in a table, similar to the java "class" design.
4, table of columns, we also called fields. All tables are one or more columns, and each column similar java "Properties"
5, the data table is stored in rows, each row in the java like "objects."

 

 

### MySQL service start and stop the
way: Computer - Right-click Management - Service
way: as an administrator to run
net start service name (to start the service)
NET STOP service name (out of service)

 

 

### MySQL service log in and out of
way: through built-in mysql client
is limited to only the root user

Second way: through windows built-in client
login:
MySQL [-h hostname] -P port number -u user name -p password

Exit:
Exit or ctrl + C

 

 

See all current database 1.
Show Databases;
2. open the specified library
use library name
3. Check all the current database tables
Show Tables;
4. See all other database tables
show tables from library name;
5. Create table
create table Table Name(

Listed among the types
listed among the types
. . .
);
6. Review the table structure
desc table name;


7. Check the server version of the
way: Log on to the mysql server
select version ();
Second way: not logged in to the mysql server
mysql --version
or
mysql --V

 

 

### MySQL syntax specification

1. not case sensitive, but it is recommended keyword capitalization, table names, column names lowercase.

2. Each command is preferably terminated by a semicolon.

3. each command as required, may be indented or line

4. Notes
single-line comments: # comment text
single-line comments: - comment text

 

### SQL language classification

DQL (Data Query Language): Data Query Language
select

DML (Data Manipulate Language): Data Manipulation Language

insert 、update、delete

 

DDL (Data Define Languge): data definition language
create, drop, alter

 

TCL (Transaction Control Language): Transaction Control Language
commit, rollback

 

## DQL language learning
### advanced 1: Basic query
syntax:
things to query SELECT
[name] FROM table;

Similar in Java: System.out.println (things to be printed);
Features:
① done by select query result is a virtual table, not the real
thing ② to query may be a constant value, can be an expression , can be a field, it can be a function

 

Guess you like

Origin www.cnblogs.com/jacksonxiao/p/11267140.html