Get the App
SLTechnology News&Howtos  ›  Database  › 

Simple understanding of the database

Shulou Source: shulou.com Published: 2022-06-01 03:04:04 09月16日 Update

Database

What is a database

A warehouse where data is stored

Data is organized and stored on the media in a specific format called a database.

Second, compare multiple database systems

A) there is no one of Oracle's best databases

B) SQL server's best database (windows)

C) MySQL Oracle sun open source

III. SQL language

A) SQL (structured query statement) Database Management system manages the data in the database through sql statements

1. Data definition language (DDL)

Used to define and manage data objects, including databases, data tables such as CREATE, DROP, etc.

two。 Data manipulation language (DML)

Used to manipulate all data in database objects such as INSERT UPDATE DELETE

3. Data query language (DQL)

Used to query all data in data objects such as SELECT

4. Data control language (DCL)

The language used to manage databases, including granting and changing permissions, database changes, such as GRANT

Why do we need to learn MySQL

I. MySQL is free

ii. Cross platform

iii. Powerful and convenient

Log in and log out of the mysql server

1. Login: the run box appears when you call windows key + r

3. Enter the following in the run box

1. Mysql-h localhost-uroot-p123456

2. Mysql-h localhost-uroot-p (recommended)

Password:*

3. Enter the password and enter enter using wamp- > mysql- > mysql console- >

4. Mysql-h localhost-uroot-p

-h hostname-u username-p password

Hostname: that's where you want to link to the database. Ip localhost is the local hostname. It can only be used locally.

Mysql-h 192.168.40.25

User name: root is the highest user in the database, super user.

Password: the default password is empty

5. If the file cannot be found by typing in the run box, do the following

Right click on the computer-> find Properties-> find Advanced system Settings-> Environment variables-> look for path above and below-> fill in the following on the path content-> (C:\ wamp\ bin\ mysql\ mysql5.7.11\ bin) you need to find your wamp path to copy and paste.

6. Quit

A) exit exit

B)\ Q exit

Note:

1. Each sql command needs to be done with a semicolon or with\ G

two。 You can split a command into multiple lines

3. You can cancel this line command through\ c

4. You can exit via exit or\ Q

We can use help through some shortcuts.

1. Set up the query results:\ G

two。 Cancel the operation that is currently completed:\ c

3. Exit the current client:\ Q

4. Show current server status:\ s

5. Display help information:\ h

View the database and create the database

i. View the database

SHOW DATABASES; (uppercase recommended)

ii. Create a database [] (square brackets represent writable but unwritable content is not a must)

CREATE DATABASE [IF NOT EXISTS] Database name (lowercase)

CREATE DATABASE IF NOT EXISTS ss21, if the database created does not exist, we create the database.

Select the database and view the data tables in the database

i. Select a database

USE database name

USE ss21

If you do not use the above command, the following error code will appear

ERROR 1046 (3D000): No database selected

ii. View data tables in the database

SHOW TABLES

IX. Delete database

DROP DATABASE [IF EXISTS] database name

For example, if DROP DATABASE IF EXISTS ss21; exists, we delete it.

Note:

1. Commands in MySQL database are not case-sensitive.

two。 Every time a database is created, a folder with the corresponding name is created in the data directory.

3. Database names are also case-insensitive under windows, but database names are strictly case-sensitive under linux.

Tags: Data database language content command password user query management host can pass size object data table system input run file best server Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Information Linux Shulou Technology Docker