Home >Database >SQL >How to create student table using sql statement?

How to create student table using sql statement?

烟雨青岚
烟雨青岚Original
2020-06-30 09:59:2135526browse

Steps: 1. Open "sql server"; 2. Use "creat table student();" to create a table; 3. Use "char()" to define the type of name, gender, and age; 4. Just use "insert into student values();" to define table attributes.

How to create student table using sql statement?

Steps:

create table Student(
  Sno char(10),
  Sname varchar(20),
  Ssex char(2),
  Sage tinyint,
  Sdept varchar(20),
  )
insert into Student values('201215121','李勇','男','20','CS'),
('201215122','刘晨','女','19','CS'),
('201215123','王敏','女','18','MA'),
('201215125','张立','男','19','IS');

We open a new query in sql

How to create student table using sql statement?

We build a table called student

How to create student table using sql statement?

We enter the student number and name, and the type is represented by characters

How to create student table using sql statement?

We enter gender, age, and major, and define them with appropriate types respectively.

How to create student table using sql statement?

At this time we press execute

How to create student table using sql statement?

and we can see that the system displays that the table was successfully created.

How to create student table using sql statement?

Recommended tutorial: "sql video tutorial"

The above is the detailed content of How to create student table using sql statement?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is slow queryNext article:What is slow query