Created
March 27, 2019 15:22
-
-
Save ryanking13/bc86be7a813376b93c30da98befda56f to your computer and use it in GitHub Desktop.
sql test queries
This file contains hidden or 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
| create table tbl (a int); | |
| create table tbl (b char(5)); | |
| create table tbl (c date); | |
| create table tbl (a int, b char(2), c date); | |
| create table tbl (a int not null); | |
| create table account ( | |
| account_number int not null, | |
| branch_name char(15), | |
| primary key(account_number) | |
| ); | |
| drop table tbl; | |
| desc tbl; | |
| show tables; | |
| select * from tbl; | |
| select * from tbl as ttbl; | |
| select col from tbl; | |
| select col, ccol from tbl, ttbl; | |
| select tbl.col as ccol from tbl, ttbl; | |
| select col from tbl where col is null; | |
| select col from tbl where col is not null; | |
| select col from tbl where tbl.col is null; | |
| select col from tbl where 1=1; | |
| select col from tbl where 1=1 or (1!=1 or 1>1); | |
| select col from tbl where 1<1; | |
| select col from tbl where 1>1; | |
| select col from tbl where 1>=1; | |
| select col from tbl where 1<=1; | |
| select col from tbl where 1!=1; | |
| select col from tbl where (1=1); | |
| select col from tbl where 'a'='b'; | |
| select col from tbl where 1234-12-34=1111-11-11; | |
| select col from tbl where 'a b' = 'a b'; | |
| select customer_name, borrower.loan_number, amount | |
| from borrower, loan | |
| where borrower.loan_number = loan.loan_number and branch_name = 'Perryridge'; | |
| insert into tbl values (1); | |
| insert into tbl values ('a'); | |
| insert into tbl values (1234-12-12); | |
| insert into tbl values (null); | |
| insert into tbl values (1, 'asdf', 1234-12-12); | |
| insert into tbl (col, ccol, cccol) values (1, 'asdf', 1234-12-12); | |
| insert into account values(9732, 'Perryridge'); | |
| delete from tbl; | |
| delete from tbl where 1=1; | |
| delete from tbl where tbl.col is null; | |
| delete from tbl where 'a b' = 'a b'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment