In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the MySQL structured query language". In the daily operation, I believe that many people have doubts about the MySQL structured query language. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is the MySQL structured query language?" Next, please follow the editor to study!
Overview of SQL
Structured Query Language structured query language is a special purpose programming language, which is a database query and programming language for accessing data and querying, updating and managing relational database systems.
Various mainstream database systems have made some modifications and extensions to the SQL specification. Therefore, in fact, the SQL between different database systems can not be completely common to each other, but most of them are the same. Later we learn the version of MySQL. After mastering the main syntax of SQL, it is relatively easy to migrate to other databases.
The structured query language consists of six parts:
1: data query language (DQL:Data Query Language):
Its statement, also known as a "data retrieval statement", is used to obtain data from a table and determine how the data is given in the application. The reserved word SELECT is the most frequently used verb in DQL (and all SQL). The other commonly used reserved words in DQL are WHERE,ORDER BY,GROUP BY and HAVING. These DQL reserved words are often used with other types of SQL statements.
Second, data manipulation language (DML:Data Manipulation Language):
Its sentences include verbs INSERT,UPDATE and DELETE. They are used to add, modify, and delete rows in the table, respectively. Also known as Action query language.
Third, transaction processing language (TPL):
Its statement ensures that all rows of the table affected by the DML statement are updated in a timely manner. TPL statements include BEGIN TRANSACTION,COMMIT and ROLLBACK.
Fourth, data control language (DCL):
Its statements are licensed through GRANT or REVOKE to determine the access of individual users and user groups to database objects. Some RDBMS can use GRANT or REVOKE to control access to individual columns of the form.
Fifth, data definition language (DDL):
Its sentences include verbs CREATE and DROP. Create a new table or delete a table (CREAT TABLE or DROP TABLE) in the database; add indexes to the table, and so on. DDL includes a number of reserved words related to obtaining data in the human database catalog. It is also part of the action query.
Six: pointer Control language (CCL):
Its statements, such as DECLARE CURSOR,FETCH INTO and UPDATE WHERE CURRENT, are used for separate operations on one or more forms.
In this chapter, we mainly introduce DDL and DML.
Operation of MySQL database
The basic syntax for creating a database is:
Create database database name
You can also specify a default character set and collation for the database:
Create database database name
Default character set character set collate collation
Select a database
Use database name
Modify the character set and collation of the database:
Alter database database name
Default character set character set collate collation
Delete the database:
Drop database database name
Check if the database exists when you delete:
Drop database if exists database name
Code example:
1.Murray-Delete the database
2.drop database if exists java1903
3.Murray-create a database
4.create database java1903
5.default character set utf8mb4
6.collate utf8mb4_general_ci
7.Murray-use the database
8.use java1903
Common data types in MySQL
After creating the database, we need to build the table, we need to set the data type of the field, let's first look at the common data types in MySQL.
Type name
Description
Storage requirement
TINYINT
A very small integer
1 byte
SMALLINT
A small integer
2 Yujie
MEDIUMINT
Medium-sized integer
3 bytes
INT (INTEGHR)
Normal-sized integers
4 bytes
BIGINT
Large integer
8 bytes
2) decimal type
Type name
Description
Storage requirement
FLOAT
Single precision floating point number
4 bytes
DOUBLE
Double precision floating point number
8 bytes
DECIMAL (M, D), DEC
Compressed "strict" fixed point number
Masks 2 bytes
3) date / time type
Type name
Date format
Date range
Storage requirement
YEAR
YYYY
1901 ~ 2155
1 byte
TIME
HH:MM:SS
-838-838-59-59-838-59
3 bytes
DATE
YYYY-MM-DD
1000-01-01-9999-12-3
3 bytes
DATETIME
YYYY-MM-DD HH:MM:SS
1000-01-01 00:00:00 ~ 9999-12-31 23:59:59
8 bytes
TIMESTAMP
YYYY-MM-DD HH:MM:SS
1980-01-01 00:00:01 UTC ~ 2040-01-19 03:14:07 UTC
4 bytes
3) string type
Type name
Description
Storage requirement
CHAR (M)
Fixed length non-binary string
M bytes, 1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 265
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.