-- 创建数据库(--表示注释)
CREATE DATABASE mydb;
-- 使用数据库
USE mydb;
DROP DATABASE mydb;
-- 删除数据库
DROP DATABASE mydb;
-- 创建表
CREATE TABLE t_student()CHARSET=utf8;
- 删除表
DROP TABLE t_student;
-- 查询表中所有记录*表示查询表中所有列
SELECT * FROM t_student;
-- 查询表中所有记录*表示查询表中所有列
SELECT * FROM t_student;
- 查询表中所有记录,但只表示id、stude两个列的值
SELECT id,studentName FROM t_student;
-- 查询所有的类别
-- DISTINCT去掉重复记录
SELECT DISTINCT p.type1 FROM t_product p;
CREATE DATABASE mydb;
-- 使用数据库
USE mydb;
DROP DATABASE mydb;
-- 删除数据库
DROP DATABASE mydb;
-- 创建表
CREATE TABLE t_student()CHARSET=utf8;
- 删除表
DROP TABLE t_student;
-- 查询表中所有记录*表示查询表中所有列
SELECT * FROM t_student;
-- 查询表中所有记录*表示查询表中所有列
SELECT * FROM t_student;
- 查询表中所有记录,但只表示id、stude两个列的值
SELECT id,studentName FROM t_student;
-- 查询所有的类别
-- DISTINCT去掉重复记录
SELECT DISTINCT p.type1 FROM t_product p;