SELECT DISTINCT *,sex AS 性别 FROM student3 ORDER BY age DESC ,NAME DESC;
SELECT id ,COUNT(NAME)AS 重复姓名,GROUP_CONCAT(NAME)AS 名字,age FROM student3 WHERE age >= 55 GROUP BY id
SELECT id ,COUNT(NAME)AS 重复姓名,GROUP_CONCAT(NAME)AS 名字,age FROM student3 GROUP BY id HAVING age>50
SELECT id ,COUNT(NAME)AS 重复姓名,GROUP_CONCAT(NAME)AS 名字,age FROM student3 GROUP BY id WITH ROLLUP
INSERT INTO student3 VALUE (1,'马云',55,'男','杭州',66,78)
SELECT id,NAME asmingzi FROM student3 WHERE math<=56 AND address = '香港'
SELECT * FROM student3 WHERE english !=30
SELECT * FROM student3 WHERE english !=99 OR math =99
USE ten;
SHOW TABLES
student3 DESC
SELECT * FROM student3 WHERE math BETWEEN 66 AND 99
CREATE TABLE `aa`(
`a` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(a));
INSERT INTO aa(a) VALUES (NULL);
SELECT DISTINCT NAME,id, math FROM student3
SELECT p.pname,c.cname,c.cid,c.price FROM person AS p,car AS c WHERE p.pid IN( SELECT pid FROM car GROUP BY pid HAVING COUNT(pid)>=2) AND p.pid=c.pid;
MySQL数据库查询初版(20191009)
最新推荐文章于 2023-06-13 16:20:38 发布