SQL learning notes series (I) SQL overview

Time:2021-11-29

SQL overview


Database related concepts

1. DB: database, a container that holds a set of organized data
2. DBMS: database management system, also known as database software (product), which is used to manage data in dB
3. SQL: structured query language, which is used to communicate with DBMS

Characteristics of database storage data

  1. Put the data into the table, and then put the table into the library
  2. There can be multiple tables in a database. Each table has a name to identify itself. Table names are unique.
  3. Tables have some features that define how data is stored in tables, similar to the design of “classes” in Java.
  4. Table bycolumnComposition, we also callfield。 All tables are composed of one or more columns, and each column is similar to “in Java”attribute
  5. The data in the table is bythat ‘s okStored, each line is similar to that in Java“object”。

Mysql-5.5.62-winx64 installation

Installation package link

https://pan.baidu.com/s/1PVMvW3tuJaabCReQ517l9wExtraction code: r67p

Teaching video link

https://www.bilibili.com/video/BV12b411K7Zu

Installation process link

https://www.cnblogs.com/LX51/p/11600318.html

Start and stop of MySQL service

  1. Method 1: Computer – right click management – Service

  2. Method 2: run as Administrator

    Net start service name (start service) (my service name is mysql, during installation)
    Net stop service name (stop service)

Login and logout of MySQL service

Method 1: through the built-in client of MySQL
Root user only

Method 2: through the built-in client (CMD) of windows
Sign in:
MySQL [- H hostname – P port number] (optional) – U username – P password

Enter MySQL – U root – P password to enter(local)

sign out:
Exit or Ctrl + C

Common MySQL commands

1. View all current databases
show databases;

2. Open the specified library
Use library name

3. View all tables in the current library
show tables;

4. View all tables of other libraries
Show tables from library name# If you use the use library, and then use this command, you still don’t go out of the previous library

select database(); # View your current library

5. Create table

Create table table name (# enter)
Column name, column type,
Column name, column type,
...
	);# (1) The last one does not need a comma, (2) error 1064 (42000): 1064 occurs because of a grammatical error (word spelling error)

6. View table structure
Desc table name;

7. View table data
Select * from table name

8. View the version of the server
Mode 1:Log in to MySQL server
select version();

Mode 2:Did not log in to the MySQL server
mysql –version
or
mysql –V

Syntax specification of MySQL

1. It is not case sensitive, but it is recommended that keywords be capitalized and table names and column names be lowercase
2. Each command should preferably end with a semicolon
3. Each command can be indented or wrapped (enter) as needed
(keywords are capitalized and preferably on a separate line)
4. Notes
	Single line notes: # note text
	Single line comment: - comment text (space before comment)
	Multiline note: / * note text*/

Installation of graphical user interface client

SQLyog-10.0.0-0
See the video for specific steps

one [email protected] #Connection object
The following is the system database and self built database
2. Query: write SQL command
3. Start flag shortcut key F9
4. Adjust font size:
Method 1: Tools - preferences - Font Editor - change
Method 2: Ctrl + mouse wheel = adjust font size

supplement

Legacy SQL uninstall

https://blog.csdn.net/weixin_41792162/article/details/89921559

SQL official website download tutorial

https://zhuanlan.zhihu.com/p/336788776

SQL official website

https://dev.mysql.com/

Solutions to various problems during installation

https://blog.csdn.net/qq_36761831/article/details/82384775
https://blog.csdn.net/q95548854/article/details/78780916
https://blog.csdn.net/weixin_39010770/article/details/85263893
DirectX repair tool v4.0 plus:https://www.muruoxi.com/pc/2403.html

Solutions to the problem that sqlyog cannot be used after installing mysql8

https://www.icode9.com/content-2-180841.html

Recommended Today

On the mutation mechanism of Clickhouse (with source code analysis)

Recently studied a bit of CH code.I found an interesting word, mutation.The word Google has the meaning of mutation, but more relevant articles translate this as “revision”. The previous article analyzed background_ pool_ Size parameter.This parameter is related to the background asynchronous worker pool merge.The asynchronous merge and mutation work in Clickhouse kernel is completed […]