Saturday 16 July 2011

Database - mysql queries -part5

Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.37-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use BookStoreSystem
Database changed
mysql> select *
-> from Branch;
+------------+-------------------+-----------------+---------------+
| Branch_Num | Branch_Name | Branch_Location | Num_Employees |
+------------+-------------------+-----------------+---------------+
| 1 | Henry Downtown | 16 Riverview | 10 |
| 2 | Henry On The Hill | 1289 Bedford | 6 |
| 3 | Henry Brentwood | Brentwood Mall | 15 |
| 4 | Henry Eastsore | Eastshore Mall | 9 |
+------------+-------------------+-----------------+---------------+
4 rows in set (0.05 sec)

mysql> select *
-> from Publisher;
+----------------+--------------------------+--------------+
| Publisher_Code | Publisher_Name | City |
+----------------+--------------------------+--------------+
| AH | Arkham House | Sauk City WI |
| AP | Areade Publishing | New York |
| BA | Basic Books | Boulder CO |
| BP | Berkley publishing | Boston |
| BY | Back Bay Books | New York |
| CT | Couse Technology | Boston |
| FA | Fawcett Books | New York |
| FS | Farrar Straus and Giroux | New York |
| HC | HarperCollins Publisher | New York |
| JP | Jove Publication | New York |
| JT | Jeremy P.Tarcher | Los Angeles |
| LB | Lb Bokks | New York |
| MP | McPherson and Co | Kingston |
| PE | Penguin USA | New York |
| PL | Plume | New York |
| PU | Putnam Publishing Group | New York |
| RH | Random House | New York |
| SB | Schoken Books | New York |
| SG | Scribner | New York |
| SS | Simon and Schuster | New York |
| ST | Scholastic Trade | New York |
| TA | Taunton Press | Newtown CT |
| TB | Tor Books | New York |
| TH | Thames and Hudson | New York |
| TO | Touchstone Books | Westport CT |
| VB | Vintage Books | New York |
| WN | W.W.Norton | New York |
| WP | Westview Press | Boulder CO |
+----------------+--------------------------+--------------+
28 rows in set (0.03 sec)

mysql> select *
-> from Author;
+------------+-------------+--------------+
| Author_Num | Author_Last | Author_First |
+------------+-------------+--------------+
| 1 | Morrison | Toni |
| 2 | Solotaroff | paul |
| 3 | Vintage | vernor |
| 4 | Francis | Dick |
| 5 | Straub | Peter |
| 6 | King | Stephen |
| 7 | Pratt | Philip |
| 8 | Chase | Truddi |
| 9 | Collins | bradley |
| 10 | Heller | Joseph |
| 11 | Will | Gary |
| 12 | Hofstadter | Douglas R |
| 13 | Lee | Harper |
| 14 | Ambrose | Stephen E |
| 15 | Rowling | J.K |
| 16 | Salinger | J.D |
| 17 | Heaney | Seamus |
| 18 | Camus | Albert |
| 19 | Collins,Jr | bradley |
| 20 | steinbeck | John |
| 21 | Castelman | Riva |
| 22 | Owen | Barbara |
| 23 | ORourke | Randy |
| 24 | Kidder | Tracy |
| 25 | Schleining | Lon |
+------------+-------------+--------------+
25 rows in set (0.05 sec)

Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.37-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use BookStoreSystem
Database changed
mysql> select *
-> From Book;
+-----------+------------------------------------------+----------------+------+
-------+-----------+
| Book_Code | Title | Publisher_Code | Type |
price | Peperback |
+-----------+------------------------------------------+----------------+------+
-------+-----------+
| 0180 | A Deepness in the Sky | TB | SFI |
7.00 | Y |
| 0189 | Magic terror | FA | HOR |
8.00 | Y |
| 0200 | The Stranger | VB | FIC |
8.00 | Y |
| 0378 | Venice | SS | ART |
24.50 | N |
| 079X | Second Wind | PU | MYS |
24.95 | N |
| 0808 | The Edge | JP | MYS |
6.99 | N |
| 1351 | Dreamcatcher A Novel | SC | HOR |
19.60 | N |
| 1382 | Treasure Chests | TA | ART |
24.46 | N |
| 138X | Beloved | PL | FIC |
12.95 | Y |
| 2226 | Harry Potter and the Prisoner of Azkaban | ST | SFI |
13.96 | N |
| 2281 | Van Gogh and Gauguin | WP | ART |
21.00 | N |
| 2766 | Of Mice and Men | PE | FIC |
6.95 | Y |
| 2908 | Electric | FS | POE |
14.00 | N |
| 3350 | Group Six People in Search of a life | BP | PSY |
10.40 | Y |
| 3743 | Nine Stories | LB | FIC |
5.99 | Y |
| 3906 | The Soul of a New Machine | BY | SCI |
11.16 | Y |
| 5163 | Travels with Charley | PE | TRA |
7.95 | Y |
| 5790 | Catch 22 | SC | FIC |
12.00 | Y |
| 6128 | jazz | PL | FIC |
12.95 | Y |
| 6328 | Band of Brothers | TO | HIS |
9.60 | Y |
| 669X | AGuide to SQL | CT | CMP |
37.95 | Y |
| 6908 | Franny and Zooey | LB | FIC |
5.99 | Y |
| 7405 | East of Eden | PE | FIC |
12.95 | Y |
| 7443 | Harry Potter and the Goblet of Fire | ST | SFI |
18.16 | N |
| 7559 | The Fall | VB | FIC |
8.00 | Y |
| 8092 | Godel Escher Bach | BA | PHI |
14.00 | Y |
| 8720 | When Rabbit Howls | JA | PSY |
6.29 | Y |
| 9611 | Black House | RH | HOR |
18.81 | N |
| 9627 | Song of Solomon | PL | FIC |
14.00 | Y |
| 9701 | The Grapes of Wrath | PE | FIC |
13.00 | Y |
| 9880 | Slay Ride | JP | MYS |
6.99 | Y |
| 9883 | The Catcher in the Rye | LB | FIC |
5.99 | Y |
| 9931 | To Kill a Mockingbird | HC | FIC |
18.00 | N |
+-----------+------------------------------------------+----------------+------+
-------+-----------+
33 rows in set (0.00 sec)








mysql> Select *
-> From Wrote;
+-----------+------------+----------+
| Book_Code | Author_Num | Sequence |
+-----------+------------+----------+
| 0180 | 3 | 1 |
| 0189 | 5 | 1 |
| 0200 | 18 | 1 |
| 0378 | 11 | 1 |
| 079X | 4 | 1 |
| 0808 | 4 | 1 |
| 1351 | 6 | 1 |
| 1382 | 23 | 2 |
| 138X | 1 | 1 |
| 2226 | 15 | 1 |
| 2281 | 19 | 2 |
| 2766 | 20 | 1 |
| 2908 | 17 | 1 |
| 3350 | 2 | 1 |
| 3743 | 16 | 1 |
| 3906 | 24 | 1 |
| 5163 | 20 | 1 |
| 5790 | 10 | 1 |
| 6128 | 1 | 1 |
| 6328 | 14 | 1 |
| 669X | 7 | 1 |
| 6908 | 16 | 1 |
| 7405 | 20 | 1 |
| 7443 | 15 | 1 |
| 7559 | 18 | 1 |
| 8092 | 12 | 1 |
| 8720 | 8 | 1 |
| 9611 | 6 | 1 |
| 9627 | 1 | 1 |
| 9701 | 20 | 1 |
| 9882 | 4 | 1 |
| 9883 | 16 | 1 |
| 9931 | 13 | 1 |
+-----------+------------+----------+
33 rows in set (0.00 sec)






mysql> Select *
-> From Inventory;
+-----------+------------+---------+
| Book_Code | Branch_Num | On_Hand |
+-----------+------------+---------+
| 0180 | 1 | 2 |
| 0189 | 2 | 2 |
| 0200 | 2 | 3 |
| 0378 | 3 | 2 |
| 079X | 2 | 1 |
| 0808 | 2 | 1 |
| 1351 | 3 | 2 |
| 1382 | 2 | 1 |
| 138X | 2 | 3 |
| 2226 | 3 | 2 |
| 2281 | 4 | 3 |
| 2766 | 3 | 2 |
| 2908 | 4 | 1 |
| 3350 | 1 | 2 |
| 3743 | 2 | 1 |
| 3906 | 3 | 2 |
| 5163 | 1 | 1 |
| 5790 | 4 | 2 |
| 6128 | 3 | 3 |
| 6328 | 2 | 2 |
| 669X | 1 | 1 |
| 6908 | 2 | 2 |
| 7405 | 3 | 2 |
| 7443 | 4 | 1 |
| 7559 | 2 | 2 |
| 8092 | 3 | 1 |
| 8720 | 1 | 3 |
| 9611 | 1 | 2 |
| 9627 | 3 | 5 |
| 9701 | 2 | 1 |
| 9882 | 3 | 3 |
| 9883 | 4 | 2 |
| 9931 | 1 | 2 |
+-----------+------------+---------+
33 rows in set (0.00 sec)

No comments:

Post a Comment