The SQL statement 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 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.
SQL: Create and Populate 'students' Table

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

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