MySQL’s initial understanding of sql statements and library operations is very important for PHP operations. This article will explain the related operations in detail.
1>Types of SQL language
SQL: Structured Query LanguageStructured Query Language
storage Process, such as CREATE DROP ALTER-->DML statement Database manipulation language:
Insert dataINSERT, delete data DELETE, update data UPDATE, query data SELECT
DCL statementDatabase control language: For example, controlling user access rights GRANT, REVOKE
It is essentially to control folders (databases), files (tables), and Add, delete, modify and check file content (data records)Create databasedb1, Essentially, a new db1 folder is created under the data directory, and
data management files are created by default under the db1 folder.
## Check: show databases; # View all libraries
Change: alter database db1 charset latin1;
Delete: drop database db1;
1.2>Operating files (tables)
Which database to operate under, use use library name to switch to the library, you can use select database (); View the current database.
As above, table t1 is created, and two files are generated correspondingly. .frm is the file that stores the table structure, and .ibd is the file that stores the corresponding table. data file.
: Show Tables;#Look at all tables
Show Create Table T1;#View a single table
1.3>Operate file content (data records in the table)
Add: insert into t1 values(1,'egon1'),(2, 'egon2'),(3,'egon3'); # Insert multiple pieces of data
use out out out out out out out through out using out out through ’ ’ s ’ through ’ use ’ s ’ through ’ through ’ through ‐ to ‐‐‐‐‐‐ lead to t1 to t1 where id=1;
2>Library related
2.1>The uses of some libraries under database.
Information_schema: Virtual library, which does not occupy disk space and is stored in memory. It is generated when the database service is started.
This library stores are some parameters after the database is started, such as user table information, column information, permission information, character information, etc.
So as shown below, the library can be viewed on the command line, but the file cannot be seen on the hard disk.
Performance_schema: A new database has been added since MySQL 5.5: mainly used to collect database server performance parameters,
Record various events, locks, etc. that occur when processing query requests Phenomenon
mysql: Authorization library, mainly stores the permission information of system users
This article is the first introduction to MySQL SQL statements and library operations are explained. For more learning materials, please pay attention to the PHP Chinese website.
Related recommendations:
How to simply implement TP5-add, delete, modify and query
How to query the last record through mysql
The above is the detailed content of MySQL's first introduction to sql statements and library operations. For more information, please follow other related articles on the PHP Chinese website!