There’s still a lot to learn about Android, but I’m going to spend some time learning about the Web. I made this decision actually very dangerous, because it is easy to be full of water, so I can only try my best to balance the situation between Android and Web. Now I plan to finish android development during the day and learn SQL after work. The reason why I do this is that, in fact, I have learned web knowledge many times, especially SQL, but because I use less, every time I look at it, I think it is a waste of time, so I decided to summarize myself and start from SQL!
1. The database
A: There are many ways to create A database. Generally, there are two ways to use SQL statements. 1
CREATE DATABASE test1;
2. Create an encoded database
CREATE DATABASE test2 CHARACTER SET gbk;
B: Check the code of a certain database
SHOW CREATE DATABASE test2;
C: Deletes the database
The DROP DATABASE library name
D: Use a database
USE test1;
E: View the database currently in use
SELECT DATABASE();
2. The table
A: Create A table – movie table, which contains field meaning, movie name, price, director, release date
CREATE TABLE movie ( mId INT(32) PRIMARY KEY auto_increment, mName VARCHAR(32), mPrice DOUBLE, mDirector VARCHAR(32), mShowDate DATE );
B. Display all tables in the current database
SHOW TABLES;
C. Add a new field to the table. Add a new movie brief description field
[constraint] ALTER table movie add mDescribtion varchar(100) not null;
D: Change the type of a field in the table (length, constraint), change the length of the field in the new table, and set the default value of this field to a string “This is not an introduction, this is not an introduction, this is just lonely”
[constraint] ALTER table movie modify mDescribtion varchar(60) default ‘this is not describtion, it is just a lone ‘;
E: Modify the description of a field in the table to mDesc and change the type and constraint
[constraint] ALTER table movie change mDescribtion mDesc varchar(88) default You see ‘;
F: drop a column from the table where mDesc was dropped
Alter table movie drop mDesc;
G: Change the table name from movie to my_movie
Rename table old table to new table rename table movie to my_movie;
H: Check the character encoding of the table
Show create table show create talbe my_movie;
I: Changes the character encoding of the table
Alter table MY_movie character set GBK;