In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's talk about the basics of MySQL. The secret of the text is to be close to the topic. So, no more gossip, let's go straight to the following, I believe you will benefit from reading this article on the basics of MySQL.
one。 Start MySql mode
1. In "computer Management", select "Service" and select "mysql" to open.
two。 Use the command line # net start mysql
two。 Turn off MySql mode
1. In computer Management, select Services, and choose to turn off mysql
two。 Use the command line # net stop mysql
three。 Log in to mysql CVM
1. Log in to MySql and use the command line # mysql-uroot-p123
two。 Log out using the command line # exit | quit
IV. DDL statement (data definition language)
Data definition language: commonly used to define database objects: libraries, tables, fields. Create, modify, delete libraries, table structures
1. Query database # show databases;2. Switch database # use database name; # use test;3. Create a new database # create database if not exits database name; # create database if not exits mydb4;4. Delete database # drop database if exits database name; # drop database if exits mydb4;5, modify database encoding format # alter database database name character set encoding format; # alter database mydb3 character set utf8;==1. Create table # create table table name (column name column type, column name column type); # create table tb_stu (pid char (20), name varchar (50), age int,gender varchar (1)); 2. View table # show tables;3. Delete table # drop table delete table name; # drop table tb_stu1;4. View the table structure # desc tb_stu;==1. Modified add column # alter table table name add (column name column type, column name column type); # alter table tb_stu add (phone varchar (13), class varchar (5)); 2. Modified column type # alter table table name modify column name new column type # alter table tb_stu modify phone varchar (11) 3. Modified modified column name # alter table table name change phone new column name new column type # alter table tb_stu change phone phoneNum varchar (11); 4. Modified delete column # alter table table name drop column name; # alter table tb_stu drop class;5. Modified table name # alter table table name rename to new table name; # alter table tb_stu rename to tb_student; v. DML statement (data manipulation language)
Data manipulation language: define database records. Add, delete, change table records
1. Insert data # INSERT INTO tb_student (number,NAME,age,gender,phonenum) VALUES (123456789'). Modify the data where operator =,! =, > =, 60 group by gender; to view groups with gender scores greater than 60 and numbers greater than 30 # select gender,count (*) from stu where score > 60 group by gender having count (*) > 30 group by gender having count 8.limit (dialect) # select * from stu limit 4 10
Is there anything you don't understand about the above basic knowledge of MySQL? Or 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.