MySQL's first introduction to sql statements and library operations

jacklove
Release: 2023-03-25 17:22:01
Original
1329 people have browsed it

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

## SQL language is mainly used for access Data, query data, update data and manage relational database systems, SQL language developed by IBM


-->DDL statement Database definition language: database, table, view, index,

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)


1.1>Operate folder (database)


As follows,

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

## Show create database db1; # View a single library


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.

Since


: Show Tables;#Look at all tables

Show Create Table T1;#View a single table

# Desc T1;

modify name char(3); t1;


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

Query: select * from t1; Specify the column

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

sql server finds the maximum value, minimum value, maximum value corresponding time, and minimum value corresponding time

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!