SQL learning notes series (I) SQL overview


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


Installation process link


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

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


Legacy SQL uninstall


SQL official website download tutorial


SQL official website


Solutions to various problems during installation

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


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 […]