The following articles are mainly about MySQL databases. In actual operations, we will involve a lot of basic skills and knowledge about MySQL databases, the following describes the details.
Create a user:
- CREATE USER 'LAOBAO'@'LOCALHOST' IDENTIFIED BY 'LAOBAO123';
- GRANT ALL PRIVILEGES
- ON *.*
- TO 'LAOBAO'@'LOCALHOST'
- WITH GRANT OPTION
MySQL database connection command: MySQL-u root-p TENNIS
- INSERT INTO TABLE TEST VALUES(NULL);
Index:
- CREATE INDEX PENALTIES_AMOUNT ON PENALTIES(AMOUNT);
You can CREATE a unique index by adding a keyword UNIQUE between the create and index keywords.
View:
- CREATE VIEW NUMBER_SETS (MATCHNO, DIFFERENCE) AS
- SELECT MATCHNO, ABS(WON-LOST)
- FROM MATCHES;
- GRANT SELECT,UPDATE
- ON
- TEAMS
- TO LAOBAO2
- DROP TABLE MATCHES;
- DROP VIEW NUMBER_SETS;
- DROP INDEX PENALTIES_AMOUNT;
- DROP DATABASE TENNIS;
- SELECT @@VERSION
- SET @@SQL_MODE = 'PIPES_AS_CONCAT'
- SET @@SQL_MODE = CONCAT(@@SQL_MODE,
- CASE @@SQL_MODE WHEN '' THEN '' ELSE ',' END,
- 'NO_ZERO_IN_DATE')
The MySQL database has two databases, including the directory table. A database named MySQL contains data about permissions, users, and tables. The structure of these tables is confidential and exclusive to MySQL. In addition, the database named INFORMATION_SCHEMA contains directory data, which partially overlaps with the data in the MySQL database. The INFORMATION_SCHEMA structure conforms to the SQL standard and looks similar to the structure of other SQL products.
The alias specified for a column can be used in most other words that are part of a select statement block, except for the from and where clauses. The new column name cannot be used in the same select statement. Therefore, select won as w and w * 2 are not allowed.
- SELECT @creditsum:=sum(credit) FROM artype;
The above content is an introduction to the MySQL database. I hope you will get something better.