Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic commands often used in mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report