数据库操作
1、创建数据库
CREATE DATABASE Test1;
2、删除数据库
DROP DATABASE Test1;
3、查询创建数据的语句
show create database TEST;
4、使用数据库
USE TEST;
5、查询当前默认的数据库以及使用的编码方式校验规则
SELECT DATABASE();
SELECT @@character_set_database, @@collation_database;
表的数据类型
create table openlab(
//Text类型
company_name char(6) comment '公司名称',
introduce varchar(100) comment '介绍',
content1 tinytext comment '内容1',
content2 text comment '内容2',
content3 mediumtext comment '内容3',
content4 longtext comment '内容4',
description1 blob comment '描述1',
description2 mediumblob comment '描述2',
description3 longblob comment '描述3',//Number类型
iq tinyint comment '0705数据库IQ',
salary smallint comment '薪资',
five_plan mediumint comment '五年计划',id int(11) comment '编号',
code_num bigint comment '代码量',weight float(3,2) comment '体重',
weather double(2,1) comment'天气',
weather_pm decimal(3,2) comment'质量',
//Date类型
date_1 date comment'年月日',
date_2 datetime comment'年月日时分秒',
date_3 timestamp comment'时间戳',
date_4 time comment'时分秒',
date_5 year comment'年'
)engine=InnoDB default character set utf8mb4 collate utf8mb4_0900_ai_ci;