# MySQL 查询

# 准备阶段

DROP TABLE IF  EXISTS class;
CREATE TABLE class(
	id INT PRIMARY KEY AUTO_INCREMENT,
	cname VARCHAR(30) NOT NULL,
	DESCRIPTION VARCHAR(100)
);
DESC class
INSERT INTO class (cname, DESCRIPTION) 
VALUES 
("linux","服务器知识"),
("mysql","数据库知识"),
("php","学习 PHP"),
("java","学习 Java");

# 获取所有行

SELECT *
FROM class;
-- 只需要其中部分的列
SELECT name, id AS ids 
FROM class;

# 条件查询

SELECT *
FROM class
WHERE 
description LIKE '%p%';
SELECT * 
FROM class 
WHERE 
  description LIKE '%p%'
  OR 
  id > 2;