Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the basic commands often used in mysql

Shulou Source: shulou.com Published: 2022-06-01 18:25:39 10月05日 Update

Let me tell you a little bit about the basic commands that are often used in mysql. Have you known about similar topics before? If you are interested, let's take a look at this article. I believe it will be of some help to you after reading the basic commands that are often used in mysql.

1. User login:

Mysql-uroot-p

2. View the database:

Show databases

3. Create a database:

Create database firstsql

4. Enter the database:

Use firstsql

5. View all the tables in the database:

Show tables

6. Create tables:

Create table student (ID char (7) primary key, NAME varchar (20) not null, Age varchar (20) default '10') comment=' Information'

Set ID as the primary key, the value of NAME cannot be empty, the default value of Age is 10, and the comment is information.

7. View the table structure

Desc firstsql.student

8. View table creation information

Show create table student

9. View table data

Select * from student;select ID,NAME,Age from Student;select * from Student where ID='001'

10. Insert data

Insert into student values ('001', 'Erha,' computer)

11. Delete data

Delete from student;delete from student where ID='001'

12. Modify data

Update student set NAME=' Internet of things' where ID='001'

What do you think of the basic commands that are often used in mysql? what do you think of this article and whether it has gained anything? If you want to know more about it, you can continue to follow our industry information section.

Tags: Data database command information article following topic interest content remarks more plate user structure industry table computer information help login Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology macOS NVidia Docker MariaDB