1----First enter the database, enter the password, no need to enter an empty password, just press Enter.
2----First check the database that you want to build: mysql>SHOW DATABASES; 3----If not, it can be created at this time, use mysql>CREATE DATABASE school; 4-----create After that, it is necessary to create a table inside. There is a condition before construction. You must first select the database to create the table. Use this command: mysql>USE school; 5-----Create database mysql> create table grade( - > id TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT, -> name VARCHAR(20) NOT NULL, -> email VARCHAR(40), -> point TINYINT(3) UNSIGNED NOT NULL, -> regdate DATETIME NOT NULL, -> PRIMARY KEY (id) -> ); 6---- Then check the database mysql>SHOW TABLES; you can see that there is a grade table created in the previous step, but it is empty. 7------Check whether there is data in it, use mysql>SELECT * FROM grade; 8-------Check the structure of the table, mysql>DESC grade;
9-------Write a data to the table mysql> INSERT INTO grade (name,email,point,regdate) VALUES -> ('Lee','[email protected]',95,NOW ()); 10------Check whether the writing is successful mysql>SELECT *FROM grade; 10-----The method of viewing multiple fields mysql>SELECT id,name,email FROM grade;
9-------Write a data to the table mysql> INSERT INTO grade (name,email,point,regdate) VALUES -> ('Lee','[email protected]',95,NOW ()); 10------Check whether the writing is successful mysql>SELECT *FROM grade; 10-----The method of viewing multiple fields mysql>SELECT id,name,email FROM grade;