Created
February 23, 2013 11:50
-
-
Save chiragmongia/5019490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc user_type; | |
+----------+-------------+------+-----+---------+-------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+----------+-------------+------+-----+---------+-------+ | |
| usertype | varchar(20) | YES | | NULL | | | |
| user | varchar(20) | YES | | NULL | | | |
+----------+-------------+------+-----+---------+-------+ | |
desc user_category; | |
+----------+-------------+------+-----+---------+-------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+----------+-------------+------+-----+---------+-------+ | |
| user | varchar(20) | YES | | NULL | | | |
| article | varchar(20) | YES | UNI | NULL | | | |
| category | varchar(30) | YES | | NULL | | | |
+----------+-------------+------+-----+---------+-------+ | |
desc article_comments; | |
+----------+-------------+------+-----+---------+-------+ | |
| Field | Type | Null | Key | Default | Extra | | |
+----------+-------------+------+-----+---------+-------+ | |
| article | varchar(20) | YES | | NULL | | | |
| comments | varchar(30) | YES | | NULL | | | |
+----------+-------------+------+-----+---------+-------+ | |
1. select article from user_category where user='user1'; | |
2. select article_comments.article, comments from article_comments inner join user_category on article_comments.article=user_category.article where user='user3'; | |
3. select article from article_comments where ISNULL(comments); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment