In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First of all, on the basis of successfully installing Mysql, go to the cmd window and log in to our mysql management system.
Login method: mysql-u username-p password
If Welcome to... appears Wait for a lot of English instructions, it means that you have successfully entered the mysql system.
Because we don't know which libraries are in the system, we use the show databases command line to show which libraries are available.
1. Create database and delete
CREATE DATABASE database name DEFAULT CHARSET='utf8'
Create database shiyan defaultcharset='utf-8'
Create a default character encoding utf-8 for the database name
Drop database database name; delete the specified database
Then use the use command to enter the newly created database
Use database name
Use the command to see which tables are in the library
Show tables
two。 Create and delete tables
Build a table sentence:
Create table table name (
Field 1 data type constraint
Field 2 data type constraint
...
Field n data type constraint)
Example:
Create table student (
Sid int primary key
Sname varchar (20) not null
Sex char (1)
Brithdate date
Note that it ends with a semicolon
Delete the table:
The name of the drop tables table; the following words indicate a successful deletion.
After you create the table, you can view the structure of each table using the desc table name.
3. Add data to the table
After the name of the desc table, you can add data to the viewed table at this level
Omit the content:
Insert into stu values (1 recorder lilinence 17)
The values of the data are in parentheses. Which data types are set when the table is created, and the data values written must meet the data requirements.
How to write the full field:
Insertinto stu (sid,sname,age) values (2)
Query the data in the table:
Select * from table name; query the entire contents of the table
Delete the data in the table:
Delete from table name; deletion is all content
(the above is my first contact with mysql database and table building, as well as the learning record of adding content to the table, which does not involve constraints, foreign keys, etc.)
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: 301
*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.