Get the App
SLTechnology News&Howtos  ›  Database  › 

The use of database SQL statements

Shulou Source: shulou.com Published: 2022-05-31 18:35:01 10月04日 Update

This article mainly explains the "use of database SQL statements", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the use of database SQL statements" bar!

1. Create database create database if not exists cs2013;2, create database tables create table if not exists comp (id int not null primary key auto_increment, pid varchar (30) not null unique, cname varchar (30) not null, ename varchar (30) not null, grade varchar (30) not null, sex int not null, clothe varchar (15) not null) default charset = utf8 Create table if not exists team (id int not null primary key auto_increment, cname varchar (30) not null, ename varchar (30) not null, coach0 int not null, coach2 int not null, stu0 int not null, stu1 int not null, stu2 int not null, isgirls int not null, email varchar (30) not null, phone varchar (15) not null Foreign key (coach0) references comp (id), foreign key (coach2) references comp (id), foreign key (stu0) references comp (id), foreign key (stu1) references comp (id), foreign key (stu2) references comp (id) default charset = utf8 Create table if not exists college (id int not null primary key auto_increment, cname varchar (30) not null, ename varchar (30) not null, teamcnt int not null) default charset = utf8 Create table if not exists rc (id int not null primary key auto_increment, college int not null, team int not null, date date not null, foreign key (college) references college (id), foreign key (team) references team (id)) default charset = utf8 Create table if not exists room (id int not null primary key auto_increment, name varchar (30) not null, totcnt int not null, regcnt int not null, price double not null) default charset = utf8 Create table if not exists hotel (id int not null primary key auto_increment, name varchar (30) not null, room0 int not null, room1 int not null, room2 int not null, foreign key (room0) references room (id), foreign key (room1) references room (id), foreign key (room2) references room (id) default charset = utf8 Create table if not exists rh (id int not null primary key auto_increment, college int not null, hotel int not null, date date not null, foreign key (college) references college (id), foreign key (hotel) references hotel (id)) default charset = utf8 Thank you for your reading, the above is the content of "the use of database SQL statements", after the study of this article, I believe you have a deeper understanding of the use of database SQL statements, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Data database sentence learning content that is ideas situations articles more knowledge knowledge points articles tables follow questions practice push research verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Xiaomi MySQL macOS Shulou Tech Info