Data application master's SQL basic tutorial sharing 2

2.SQL

Learn about SQL

1. What is SQL

 

【Introduction to knowledge points】

After understanding the database, let's get to know SQL.
SQL is the abbreviation of Structured Query Language, that is, Structured Query Language, which is a standard language specially used to "communicate" with the database (access and process the database).
We can use SQL to work with many database programs such as MySQL, Oracle, Ms Access, SQL Server and many more.

2, SQL language classification

 

【Introduction to knowledge points】

We will introduce the syntax of SQL in detail in the following chapters. In this section, you can understand it a little.
The language in SQL is divided into four types: DQL, DML, DDL, and DCL:

Data Query Language DQL
Data Query Language The basic structure of DQL is a query block composed of a SELECT clause, a FROM clause, a WHERE clause (and an ORDER BY clause):
SELECT <field name table>
FROM <table or view name>
WHERE <query condition>

data manipulation language DML
data manipulation language DML has three main statements:
insert: INSERT
update: UPDATE
delete: DELETE

data definition language DDL
data definition language DDL is used to create Various objects in the database - tables, views, indexes, synonyms, clusters, etc. such as:
CREATE TABLE/VIEW/INDEX/SYN/CLUSTER

Data Control Language DCL
Data Control Language DCL is used to grant or revoke certain privileges to access the database , and control the time and effect of database manipulation transactions, and monitor the database, such as:
GRANT, authorization;
ROLLBACK, rollback command to make the database state return to the last submitted state;
COMMIT [WORK], submit.

3. SQL data types

 

【Introduction to knowledge points】

Since it is data, there must be data types. After all, data types are the characteristics of the data itself.
SQL is no exception, and its most basic data types are as follows:
string type;
numeric type;
date and time type;
custom type.

Due to the existence of different database programs, they all have their own complete set of rules for data types. If you want to know more about the data structure of SQL and other database programs, you may as well find the information on the Internet.
In this section, we only give a brief basic introduction to the SQL data types, and a little understanding is enough:

String type:
char(x), fixed-length string type, x is a number, and the number of specified characters (up to more than 255 characters);
varchar(x), variable-length string type, x is a number, indicating the maximum number of characters that can be held (up to 255 characters);
text or blob, generally more than 255 characters in strings Use text to define.

Numeric type:
numeric, a general numeric type in SQL, the value can be 0, positive or negative, floating-point, fixed-point;
integer, int, integer number;
decimal(x,y), decimal type, x represents significant digits, y represents the number of digits reserved after the decimal point;
float, a floating point type.

Date and time types:
date, time;
datetime, including year, month, day, hour, minute, second;
timestamp.

Boolean:
True, False, Null, where Null means no value, when it is defined by '', that is, 'Null', which means the character Null itself.

Custom type:
a data type defined by the user, a data type we define according to our own needs, which greatly enriches the flexibility of data storage in our database.

4. Summary

 

【Introduction to knowledge points】

This chapter mainly explains some basic knowledge of database and SQL to everyone, without involving specific SQL statements and syntax. I hope everyone can have a certain degree of understanding of the language of database and SQL.
In addition, a little more knowledge, in SQL statements, the case of letters is not sensitive, only the data itself is case-sensitive.

 

To be continued below. . . . . .

 

Welcome to visit our official website:

http://www.datanew.com/datanew/homepage

http://www.lechuangzhe.com/homepage

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326249009&siteId=291194637