Data application master's SQL basic tutorial sharing 1

SQL Basic Tutorial

 

Foreword:

Netsun has been focusing on the field of data application for 16 years, and has strong technical support in the fields of report production, chart display, software development, etc. Today, I will share some knowledge of SQL language with you, hoping to help beginners.

 

Introduction:
Teach you to master the basics of SQL, and learn to use SQL to access and manipulate data in data systems.

Introduction:
SQL is the most widely used ANSI standard computer language for accessing and manipulating database systems. Whether you are an application developer, database administrator, web designer, or mobile terminal developer, mastering the language of SQL is very important to make good use of databases, such as MS Access, Informix, SQL Server, Oracle, Sybase, DB2, etc. .
This course mainly explains the basic knowledge of SQL. We start with simple data retrieval and query, and gradually transition to some more complex content, such as joins, subqueries, cursors, table constraints and other knowledge. You can learn the knowledge and skills of SQL step by step, systematically and intuitively from this course.

 

Chapter 1 Understanding Databases and SQL


(What is a database? What is the SQL language? In this chapter, we will give a brief introduction to the two, which will help you learn SQL in the future.)

 

1. Database Basics

Learn about databases

1. What is a database

【Introduction to knowledge points】

Before starting to learn SQL, whether you are a programmer or an IT novice, it is helpful to have a basic understanding (or revisit) of databases and SQL.
The database we often say is usually a file or a group of files. It is a container used to store organized data. We can figuratively understand it as a file cabinet for storing data.

2. Table

[Introduction to knowledge points]
The file cabinet in the above section is an example. When we store specific materials, we do not store them at random, but first create a file bag in the file cabinet, and then put the relevant materials in a specific file bag. middle.
That bag of files is a table, a table, by definition, a structured list of a particular data type.
The key here is that the data stored in the table is the same type of data, and the identifier (name) of the table in the database is unique.

3. Column

【Introduction to knowledge points】

All tables in a database are composed of one or more columns.
Column (column), we can understand it as a spreadsheet, each column is specific information, such as a student information table, which will contain:
student number,
name ,
gender ,
major
...
and other columns.

4. Line

【Introduction to knowledge points】

The data in the table is stored according to the row, and the row is the place used to store the data.
Continuing the student information table in the previous section as an example, the row stores the specific information of each student.

Student Information - Examples of Tables, Columns, Rows:


 

5. Primary key

【Introduction to knowledge points】

Each row of data in the table should have one or several columns to uniquely identify itself. This uniquely identified column (or several columns) is called the primary key.
For example, in the student table mentioned above, we should use the student ID column as the primary key, and the student ID becomes the unique identifier of the student information.

So why do you need a primary key?
Although not all tables require a primary key, most databases are designed to ensure that each of their tables has a primary key, which is to provide convenience and reliability for data operation management in the future.

We should pay attention to two points when setting the primary key:
the data of any two rows of the primary key must be different;
each row must have a primary key, and cannot be Null (null).

 

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=326350570&siteId=291194637