Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> SELECT * FROM wizard where birthday between '1975-01-01' and '1985-12-31';
- +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
- | id | firstname | lastname | birthday | birth_place | biography | is_muggle |
- +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
- | 1 | harry | potter | 1980-07-31 | london | | 0 |
- | 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
- | 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
- | 5 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 |
- | 6 | fred | weasley | 1978-04-01 | | | 0 |
- | 7 | george | weasley | 1978-04-01 | | | 0 |
- | 10 | drago | malefoy | 1980-06-05 | | | 0 |
- | 14 | dudley | dursley | 1980-06-23 | | Cousin d'Harry | 1 |
- +----+-----------+----------+------------+-------------+---------------------------------------+-----------+
- 8 rows in set (0.00 sec)
- mysql> SELECT firstname FROM wizard WHERE firstname LIKE 'H%';
- +-----------+
- | firstname |
- +-----------+
- | harry |
- | hermione |
- +-----------+
- 2 rows in set (0.00 sec)
- mysql> SELECT firstname, lastname FROM wizard WHERE lastname LIKE 'Potter%' ORDER BY ASC;
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC' at line 1
- mysql> SELECT firstname, lastname FROM wizard WHERE lastname LIKE 'Potter%' ORDER BY lastname ASC;
- +-----------+----------+
- | firstname | lastname |
- +-----------+----------+
- | harry | potter |
- | lily | potter |
- +-----------+----------+
- 2 rows in set (0.00 sec)
- mysql> SELECT firstname, lastname, birthday FROM wizard order by birthday asc limit 1;
- +-----------+------------+------------+
- | firstname | lastname | birthday |
- +-----------+------------+------------+
- | albus | dumbledore | 1881-07-01 |
- +-----------+------------+------------+
- 1 row in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement