By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

SQL Query help

P: n/a
Hi
I need to write some queries for a collage assignment but I am really
struggling.I am very new to any form of SQL.

I have the following tables. Sorry about the formatting.
+-----+-------------+------------------+---------+--------+------------+
| CNO | CNAME | STREET | TOWN | BROKER | DOJ |
+-----+-------------+------------------+---------+--------+------------+
| 1 | CARTER | 10 BARNABY COAST | BBURN | 1 | 1988-03-01 |
| 2 | HOLDSWORTH | 15 SNOB HILL | BBURN | 3 | 1992-08-01 |
| 3 | GT PENS FND | 10 HIGH STREET | BBURN | NULL | 1993-06-17 |
| 4 | INVEST INC | 18 PALL MALL | CHORLEY | 1 | 1992-01-02 |
| 5 | WILSON | 12 GRAND MALL | CHORLEY | 1 | 1985-04-01 |
| 6 | AINSWORTH | 18 GRAND MALL | CHORLEY | 2 | 1985-03-01 |
| 7 | YUPPIES INC | 305 KINGSWAY | LONDON | NULL | 1991-06-17 |
+-----+-------------+------------------+---------+--------+------------+
7 rows in set (0.35 sec)

mysql> select * from holding;
+------+----------------+------------+------+------------+
| CNO | SNAME | TDATE | QTY | PURCHPRICE |
+------+----------------+------------+------+------------+
| 1 | MIRROR GROUP | 1994-05-01 | 200 | 160 |
| 1 | ARAN ENERGY | 1994-05-01 | 1000 | 24 |
| 1 | EURODISNEY | 1994-05-01 | 500 | 160 |
| 2 | OWNERS ABROAD | 1994-05-04 | 500 | 90 |
| 1 | CARLTON COMM | 1994-05-04 | 1000 | 1000 |
| 3 | SLEEPY KIDS | 1994-05-04 | 800 | 150 |
| 2 | MIDLAND | 1994-05-05 | 400 | 152 |
| 4 | ROYAL DUTCH | 1994-05-06 | 300 | 6500 |
| 4 | MIDLAND | 1994-05-06 | 200 | 155 |
| 2 | WHITBREAD | 1994-05-07 | 500 | 500 |
| 2 | BRITISH PETROL | 1994-05-07 | 400 | 380 |
| 2 | WHITBREAD | 1994-05-11 | 200 | 510 |
| 3 | CARLTON COMM | 1994-05-12 | 1000 | 900 |
| 2 | AIRTOURS | 1994-05-14 | 500 | 520 |
+------+----------------+------------+------+------------+
14 rows in set (0.04 sec)

mysql> select * from shares
-> ;
+----------------+------------+--------+------+------+
| SNAME | SCAT | CPRICE | LOW | HIGH |
+----------------+------------+--------+------+------+
| MIDLAND | MEDIA | 164 | 152 | 177 |
| CARLTON COMM | MEDIA | 884 | 797 | 1025 |
| MIRROR GROUP | MEDIA | 152 | 123 | 201 |
| SLEEPY KIDS | MEDIA | 66 | 64 | 67 |
| ARAN ENERGY | OILS | 32 | 24 | 33 |
| BRITISH PETROL | OILS | 400 | 349 | 411 |
| ROYAL DUTCH | OILS | 6600 | 6500 | 7437 |
| AIRTOURS | LEIS/HOTEL | 463 | 418 | 553 |
| EURODISNEY | LEIS/HOTEL | 124 | 119 | 195 |
| N LEIS | LEIS/HOTEL | 50 | 40 | 57 |
| OWNERS ABROAD | LEIS/HOTEL | 103 | 89 | 129 |
| BODDINGTONS | BREWERIES | 265 | 250 | 295 |
| WHITBREAD | BREWERIES | 541 | 496 | 614 |
+----------------+------------+--------+------+------+
13 rows in set (0.04 sec)

mysql> select * from broker;
+-----+---------+------------+----------+
| BNO | BNAME | BTOWN | COMMRATE |
+-----+---------+------------+----------+
| 1 | ABC LTD | CHORLEY | 10 |
| 2 | XYZ LTD | OSWTWISTLE | 8 |
| 3 | WHITES | BBURN | 12 |
+-----+---------+------------+----------+
3 rows in set (0.06 sec)

From these I need to answer 15 questions. I have managed the first 4 but
can't seem to get any further.

the first one I'm stuck on is to do with null values.
I need to list the client names & broker names for all clients including
those who do not have a broker.
I have using the IFNULL but with no success.
Could somebody please help me out?
cheers

Kin
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ask your professor for help.

---
Steve

Jul 23 '05 #2

P: n/a
cheers for that

"Steve" <go********@nastysoft.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Ask your professor for help.

---
Steve

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.