mysql创建数据库

时间:2022-10-22 08:25:45

创建一个名为Library:

CREATE DATABASE Library;

针对这个数据库,创建表

USE library;
CREATE TABLE student(
student_id
INT(20) NOT NULL PRIMARY KEY auto_increment,
student_password
CHAR NOT NULL,
student_name
CHAR NOT NULL,
student_major
CHAR NOT NULL,
student_class
CHAR NOT NULL,
gender
CHAR
)

创建book表:

USE library;
CREATE TABLE book(
book_id
INT(20) NOT NULL PRIMARY KEY auto_increment,
book_name
CHAR NOT NULL,
book_price
CHAR NOT NULL
)