mysql basic piece
How to enter mysql
Note: Some are users who have newly installed mysql, so they don’t have a password, and you can enter directly by pressing Enter
You can't do without four words in the database-add, delete, modify, check, of course, you can't do without one thing,
that is,
you have to create a database first, and then have a table, otherwise how to operate. . . . .
1. Basic operations how to create libraries and tables
1. How to create a library, assuming the name of my library is abc
create database abc;
2. How to create a table, assuming the name of my table is abcd
create table `abcd` (name varchar(128));
2. How to view libraries and tables for basic operations
1. How to view the current library
show databases;
2. How to use the library
use 某个 `database`;
3. How to view the table
show tables;
3. Add, delete, modify and check
Well, with the basic part above, we can start the key part of today-the addition, deletion, and modification of horror, why is it horrible? Now you may not realize it, but when you learn the trick, you will know
1 . Forgot to forget, insert one. . .
How to query the created field information after the table is created
describe+表名字
You will be surprised to find that the same insert sentence, but you can only insert pinyin or English, why, because you did not modify the format, you can't think of it. . . . (I didn't think about it)
So, how to modify the format and insert Chinese
Here comes the knowledge point of tuition
1. Check the table character type (don’t forget that I created a library called abc)
show create database abc;
2. Modify the default character type of the library
alter database abc character set utf8;
3. The modification of the table is the same as the library, I will not write
1. Okay, now start to insert the data
2. After adding, you can view
* means query all
but you can also query the specified column, I wrote it all. . . .
3. Specify the list to delete all information. Note that even if you delete all here, you don’t need to multiply and delete it directly.
4. Alright, the last modification operation
. . End
Simply summarize,
create create,
add insert,
delete delete,
modify update
query, and delete