Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basics of getting started with MySQL

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the basic knowledge of getting started with MySQL". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the basic knowledge of getting started with MySQL".

Basic Concepts and basic commands 1) basic Concepts ① Database

A warehouse that stores and manages data according to a certain data structure.

Classification of ② Database

The common classification of database is to divide the database into relational database and non-relational database.

③ what is a relational database?

The complex relationship is expressed in a simple binary form, that is, in the form of rows and columns (table form), where each row is called a record and the column is called a field. Among them, MySQL is a very commonly used relational database.

Binary form: similar to excel tabular data, it is a binary form.

④ database management system: DBMS

Database management system is a software used to manage and operate database.

Relational database management system (RDBMS) includes Oracle, MySQL, SQL Server, DB2, IBM and so on.

Non-relational database management system (Nosql) includes redis, Hbase, mongodb, neo4j and so on.

Introduction to ⑤ MySQL

MySQL is a relational database management system. The product was originally designed by mysql ab and later acquired by Oracle Database. MySQL database manages data in the form of sub-database and sub-table. A MySQL database management system can manage multiple databases; multiple tables can be stored in one database. At the same time, MySQL is open source free, supports tens of millions of levels of data query, and supports GPL (open source license).

⑥ what is the SQL language?

SQL language, whose full name is "structured query language", is called structured query language, which is a standardized language for operating database and can access the database.

⑦ pay attention to the difference between MySQL and SQL!

There is a wrong saying: can you MySQL? In fact, this statement is problematic. MySQL actually refers to the database management system, asking if you can MySQL, but actually asking whether you will add, delete, change, and check the database, so this MySQL is talking about the "SQL language" mentioned earlier, but we habitually use MySQL instead of SQL.

Classification of the ⑧ SQL language ⑨ what is a "table"?

A table is a structured list of a particular type of data.

The "specific type" here refers to the data stored in the table, which is a type of data. You can't mix a list of customer information with a list of orders and store them in the same database table. It becomes difficult to retrieve and access the data in the future, so we should have a list and a table.

Each database should have a table name that uniquely identifies itself. You cannot have two tables with the same table name in the same database, but the same table name can be used in different databases.

What is "column" in ⑩?

A table consists of columns, each of which stores information about a part of the table. Each column is a field in the table. A table consists of one or more columns.

It is important to note that each column in the table should store a specific piece of information. For example, provinces, cities, and postal codes should all be separate columns. We can't combine these three different pieces of information into one column, otherwise it will add a lot of trouble to the query.

What is a "data type" in ⑪?

Each column in the table should have a corresponding data type, which indicates what data the column can store.

The commonly used data types are string type, numeric type, date type. A detailed description of the data types will be given in a later series of articles.

Data types play an important role in helping to sort data correctly and play an important role in optimizing disk usage.

What is "OK" in ⑫?

The data in the table is stored in rows, and each row represents a record. If you think of a table as a grid, the vertical columns in the grid behave the table rows horizontally.

2) basic command ① to connect to the database

MySQL database is a "client-server" type of database management system. Vividly speaking, a MySQL database management system has at least two parts, one is the server side, which we can not see, but every time we use the database, we always get data from it. The second is the client, I often use the client has CMD window, Navicat, these clients can let us enter SQL statements for data access and access. Therefore, we need to log in to the database management system before executing the command.

"to log in to the MySQL database, you need the following information"

Hostname port username user password (password)

Mysql-h localhost-u root-P 3306-p 123

-h hostname: localhost indicates that the server is local

-u user name: user name root

-P port: default port 3306

-p password: password 123

In the CMD black window, if you log in to the MySQL database, the interface is as follows:

② Select Database

When you first connect to the database, no database is open for you to use. Before you can perform operations on any database, you need to select a database.

Basic Syntax: use database name

Use huangwei

"

Note: in the CMD black window, each line of code must be followed by a semicolon. But in a lot of software

Use SQL statements without ";" semicolons, sometimes ";" semicolons can also make mistakes.

③ understands databases and tables

Show databases: returns a list of available databases

Show tables: returns a list of database tables

Show columns from table name: returns the specific information of a table, which is equivalent to "desc+ table name"

Writing order and execution order of SQL statements

If you want to learn SQL sentences well, you must first understand the writing order and execution order of SQL statements. The inconsistency between the writing order and the execution order of SQL statements is an important reason for the miswriting and inability of SQL. In view of this, in the process of learning SQL sentences, you should have a good understanding of the concepts of "writing order" and "execution order".

1) the writing order of a complete SQL query statement-- "mysql statement writing order"

1 select distinct *

2 from table (or result set)

3 where...

4 group by... Having...

5 order by...

6 limit start,length

Note: 1 and 2 are the most basic sentences and must contain.

Note: 1 and 2 can be collocated with any of 3, 4, 5, 6, or with more than 3, 4, 5, 6 at the same time. 2) A complete execution order of SQL statements

The explanation of the above figure is as follows:

3) explanation about who comes before and who comes after in the execution order of select and having

Thank you for your reading, the above is the content of "what is the basic knowledge of entry MySQL". After the study of this article, I believe you have a deeper understanding of what the basic knowledge of entry MySQL has, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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: 0

*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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report