SQL

  1. what is database?

A database is an organized collection of data that allows users to easily store, access, and manage information. It is essentially a digital storehouse where data can be stored and organized in a structured way.

2.what is Database management System?

A Database Management System (DBMS) is an application software used to control and manage data through a database. It allows users to store, organize, access, and manipulate data in a structured way. A database is an organized collection of data that provides a digital storehouse for information. By using a DBMS, organizations can improve efficiency and productivity by streamlining data management processes. With the ability to control and manage data, users can easily retrieve and analyze information, which can lead to better decision-making.

3.what is SQl ?

It is a high-level programming language that is specifically designed to manage and operate databases. This means that it provides a comprehensive set of standards and rules that govern the way databases are created, accessed, and managed.

  1. How to Start and Stop MySQL on Windows

1).find run and write services.msc

find mysql80 botton

2).use cmd

1
2
3
4
5
#start 
net start mysql80
#stop
net stop mysql80

  1. use sql command line

Screenshot 2023-08-20 224841.png

  1. use windons cmd

1) Configuring path on Windows.

Screenshot 2023-08-20 225405.png

1
mysql [-h 127.0.01] [-p3306] -u root -p

Screenshot 2023-08-20 225628.png

7.what is Relational database

A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970.[1] A system used to maintain relational databases is a relational database management system (RDBMS). Many relational database systems are equipped with the option of using SQL (Structured Query Language) for querying and updating the database.[2]

(form wiki ,https://en.wikipedia.org/wiki/Relational_database)

Screenshot 2023-09-18 134043.png

DDL

查询所有数据库

1
SHOW DATABASES;

Screenshot 2023-09-18 152201.png

查询当前数据库

1
2

SELECT DATABASE();

创建

1
CREATE DATABASE [IF NOT EXISTS] 数据库名 [DEFAULT CHARSET 字符集] [COLLATE 排列顺序]

Screenshot 2023-09-18 152436.png

Screenshot 2023-09-18 152406.png

删除

1
DROP DATABASE [IF EXISTS] 数据库名

Screenshot 2023-09-18 152930.png

使用

1
USE 数据库名称

Screenshot 2023-09-18 153206.png

查询

查询当前数据库的所有表

1
SHOW TABLES:

查询表结构

1
DESC 表名

查询指定表的建表语句

1
SHOW CREATE TABLE 表名