The SQL statement you provided creates a table named "students" if it does not already exist, with the following columns:

  • "id" of type INT, which is the primary key and is set to auto-increment.
  • "name" of type VARCHAR(50), which can hold a maximum of 50 characters.
  • "age" of type INT, which represents the age of the student.
  • "score" of type FLOAT, which represents the score of the student.
  • "sex" of type INT, which represents the gender of the student. This column is set to NOT NULL, meaning it must have a value.

The INSERT statement then adds four rows of data into the "students" table:

  1. The first row has id=1, name='苏航', age=18, score=80.2, and sex=1.
  2. The second row has id=2, name='杨可', age=20, score=100.0, and sex=0.
  3. The third row has id=3, name='马行', age=30, score=100.0, and sex=1.
  4. The fourth row has id=4, name='马可', age=20, score=40, and sex=1.
CREATE TABLE IF NOT EXISTS students id INT PRIMARY KEY AUTO_INCREMENTname VARCHAR50age INTscore FLOATsex INT NOT NULL;INSERT INTO students values1苏航1880212杨可20100003马行30100014马可20401;

原文地址: http://www.cveoy.top/t/topic/i5w0 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录