qiezi的学习园地

AS/C/C++/D/Java/JS/Python/Ruby

  C++博客 :: 首页 :: 新随笔 ::  ::  :: 管理 ::

好久没写SQL查询语句了,想了好久也没想出来,于是上CSDN以帖询问,有一热心老兄给了一段:

CREATE TABLE store (
 bookname VARCHAR(255) NOT NULL,
 username VARCHAR(255) NOT NULL,
 PRIMARY KEY (bookname, username)
);


INSERT INTO store (bookname, username) VALUES ('C++编程语言', 'a');
INSERT INTO store (bookname, username) VALUES ('C++对象模型', 'a');
INSERT INTO store (bookname, username) VALUES ('C++24小时通', 'a');
INSERT INTO store (bookname, username) VALUES ('C++速成', 'a');

INSERT INTO store (bookname, username) VALUES ('C++编程语言', 'b');
INSERT INTO store (bookname, username) VALUES ('C++对象模型', 'b');
INSERT INTO store (bookname, username) VALUES ('C++24小时通', 'b');
INSERT INTO store (bookname, username) VALUES ('C++速成', 'b');

INSERT INTO store (bookname, username) VALUES ('C++编程语言', 'c');
INSERT INTO store (bookname, username) VALUES ('C++对象模型', 'c');
INSERT INTO store (bookname, username) VALUES ('C++24小时通', 'c');
INSERT INTO store (bookname, username) VALUES ('C++速成', 'c');

INSERT INTO store (bookname, username) VALUES ('C++编程语言', 'd');
INSERT INTO store (bookname, username) VALUES ('C++24小时通', 'd');
INSERT INTO store (bookname, username) VALUES ('C++速成', 'd');

INSERT INTO store (bookname, username) VALUES ('C++编程语言', 'e');
INSERT INTO store (bookname, username) VALUES ('C++速成', 'e');

 

select bookname, count(*) from store where username in
(
 select username from store where bookname = 'C++编程语言'
)
and bookname <> 'C++编程语言'
group by bookname
having count(*) >= 0
order by count(*) desc
limit 2;


看完不禁哑然。这不是以前就用过的么?怎么现在都不会了?

想起以前在学校,最擅长的大概就是数据库了吧,接下来被老师拉去做C开发。找的第一个工作是WEB开发的,做了一段时间没什么兴趣。接下来是java开发,2个项目后又因为客户端视频控件的原因,回到C语言。然后又是服务器开发,这次用C++了。几个月后又因为部分项目外包的原因,开始学习python开发。最近又回到WEB开发了。

感觉一直是换来换去,自己都搞不准该往哪个方向走,学的东西倒是多了,不过大都不深入。长此以往,我还能说自己“熟练掌握”什么?

posted on 2005-12-07 17:55 qiezi 阅读(357) 评论(0)  编辑 收藏 引用 所属分类: 杂谈