上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要: 题目描述 查找字符串'10,A,B' 中逗号','出现的次数cnt。 SQL: select length('10,A,B')-length(replace('10,A,B',',','')) length():统计字符串长度 replace(字符串,“需要替换的子串”,“用于替换子串的字符串”), 阅读全文
posted @ 2019-04-22 09:28 柯汐 阅读(832) 评论(0) 推荐(0)
摘要: 题目描述 将employees表中的所有员工的last_name和first_name通过(')连接起来。CREATE TABLE `employees` (`emp_no` int(11) NOT NULL,`birth_date` date NOT NULL,`first_name` varch 阅读全文
posted @ 2019-04-22 09:20 柯汐 阅读(610) 评论(0) 推荐(0)
摘要: 题目描述 针对库中的所有表生成select count(*)对应的SQL语句CREATE TABLE `employees` (`emp_no` int(11) NOT NULL,`birth_date` date NOT NULL,`first_name` varchar(14) NOT NULL 阅读全文
posted @ 2019-04-22 09:17 柯汐 阅读(492) 评论(0) 推荐(0)
摘要: 题目描述 将所有获取奖金的员工当前的薪水增加10%。create table emp_bonus(emp_no int not null,recevied datetime not null,btype smallint not null);CREATE TABLE `salaries` (`emp 阅读全文
posted @ 2019-04-22 09:10 柯汐 阅读(1073) 评论(0) 推荐(1)
摘要: 题目描述 存在如下的视图:create view emp_v as select * from employees where emp_no >10005;如何获取emp_v和employees有相同的数据?CREATE TABLE `employees` (`emp_no` int(11) NOT 阅读全文
posted @ 2019-04-22 09:03 柯汐 阅读(214) 评论(0) 推荐(0)
摘要: 题目描述 在audit表上创建外键约束,其emp_no对应employees_test表的主键id。CREATE TABLE employees_test(ID INT PRIMARY KEY NOT NULL,NAME TEXT NOT NULL,AGE INT NOT NULL,ADDRESS 阅读全文
posted @ 2019-04-19 16:46 柯汐 阅读(209) 评论(0) 推荐(0)
摘要: 题目描述 将titles_test表名修改为titles_2017。CREATE TABLE IF NOT EXISTS titles_test (id int(11) not null primary key,emp_no int(11) NOT NULL,title varchar(50) NO 阅读全文
posted @ 2019-04-19 16:35 柯汐 阅读(385) 评论(0) 推荐(0)
摘要: 题目描述 将id=5以及emp_no=10001的行数据替换成id=5以及emp_no=10005,其他数据保持不变,使用replace实现。CREATE TABLE IF NOT EXISTS titles_test (id int(11) not null primary key,emp_no 阅读全文
posted @ 2019-04-19 16:34 柯汐 阅读(202) 评论(0) 推荐(0)
摘要: 题目描述 将所有to_date为9999-01-01的全部更新为NULL,且 from_date更新为2001-01-01。CREATE TABLE IF NOT EXISTS titles_test (id int(11) not null primary key,emp_no int(11) N 阅读全文
posted @ 2019-04-19 16:26 柯汐 阅读(269) 评论(0) 推荐(0)
摘要: 题目描述 删除emp_no重复的记录,只保留最小的id对应的记录。CREATE TABLE IF NOT EXISTS titles_test (id int(11) not null primary key,emp_no int(11) NOT NULL,title varchar(50) NOT 阅读全文
posted @ 2019-04-19 16:23 柯汐 阅读(337) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页