qfedu-linux-advanced-level/day9/homework/h1.sql

30 lines
703 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
创建数据库bookdb在bookdb数据库中创建login登录表。表结构 login(login_id 登录编号, name 登录名, passwd 密码create_time 注册时间, last_time 最近登录时间 )。
【提示】表字段类型: 根据信息的分类确定。
*/
-- 删除原有数据库
-- drop database if exists bookdb;
-- 创建数据库
CREATE DATABASE IF NOT EXISTS bookdb;
-- 进入bookdb数据库
USE bookdb;
-- 创建login表
CREATE TABLE IF NOT EXISTS
login(
-- 主键
login_id INT PRIMARY KEY,
name VARCHAR(50),
passwd VARCHAR(50),
create_time DATETIME,
last_time DATETIME
);
-- 显示数据库bookdb结构
SHOW TABLES;
-- 显示表结构
DESCRIBE login;