SQL题目

select * from Member where MemberID >= (select MemberID from Member limit 100000,1) limit 100;

CASE WHEN age < 18 THEN '未成年人' WHEN age < 60 THEN '成年人' ELSE '老年人' END

MySQL中ISNULL只是用来判断是否为空,不能实现替换功能,所以用IFNULL代替,语法和上面的ISNULL一样。

SELECT * FROM table WHERE RAND() <= .3,这样可以抽出约30%的数据,然后再用TOP或者LIMIT子句。

插入
INSERT INTO table_name (col1, col2, ...) VALUES (value1, value2, ...)

INSERT INTO table_name (col1, col2, ...) SELECT col1, col2, ... FROM table_name WHERE search_condition

UPDATE table_name SET col1 = value1 [, col2 = value2] ...
WHERE search_condition

你可能感兴趣的:(SQL题目)