473,809 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Query help

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
2 1275
Ask your professor for help.

---
Steve

Jul 23 '05 #2
cheers for that

"Steve" <go********@nas tysoft.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Ask your professor for help.

---
Steve

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3141
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
7
5973
by: Simon Bailey | last post by:
How do you created a query in VB? I have a button on a form that signifies a certain computer in a computer suite. On clicking on this button i would like to create a query searching for all details invovling that computer, for the user to then view. Any ideas on some code? Many thanks for any help.
4
2077
by: d.p. | last post by:
Hi all, I'm using MS Access 2003. Bare with me on this description....here's the situation: Imagine insurance, and working out premiums for different insured properties. The rates for calculating premiums are dependant on the country in which the client is in. Therefore, we have a Country table, with its list of rates, a client table and then the property table. Getting this is great, works fine, easy! Problem is, now I need to work out a...
4
2863
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table query. I'm having trouble doing it. Help! Here is my code so far: Sub OldRegionQuery()
36
3076
by: Liam.M | last post by:
hey guys, I have one last problem to fix, and then my database is essentially done...I would therefore very much appreciate any assistance anyone would be able to provide me with. Currently I have set up a Query to show only records that meet a certain criteria...therefore excluding all of the records that do not meet this criteria (just for the record the criteria is any record within my database that falls within two months of its "Due...
5
7372
by: elitecodex | last post by:
Hey everyone. I have this query select * from `TableName` where `SomeIDField` 0 I can open a mysql command prompt and execute this command with no issues. However, Im trying to issue the same command inside of mysql_real_query and I keep on getting this error back. "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
10
6239
by: aaronrm | last post by:
I have a real simple cross-tab query that I am trying to sum on as the action but I am getting the "data type mismatch criteria expression" error. About three queries up the food chain from this cross-tab query I am using a simple query with no grouping where I am filtering some data out in the criteria line. I have been out of access for a couple years but I remember in the past I had a solution for this but I can't remember. Any help...
11
16338
by: funky | last post by:
hello, I've got a big problem ad i'm not able to resolve it. We have a server running oracle 10g version 10.1.0. We usually use access as front end and connect database tables for data extraction. We have been using oracle client 10.1.0.2 with it's odbc for a while without problem. The problem arose when we decided to reconnect all the tables and save password. Some query became suddenly very slow. Then I've discovered that the tables...
4
2045
by: Doris | last post by:
It does not look like my message is posting....if this is a 2nd or 3rd message, please forgive me as I really don't know how this site works. I want to apologize ahead of time for being a novice with MS Access and VBA. I desperately need help with 2 queries that I am trying to put together. I want to thank anyone that can help me out with this situation. I want to put a select query(Query1) that uses one table and the criteria would...
6
4412
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one field between them. The join field in both tables are indexed and I'm selecting 1 field from each table to lookup. The Access query is taking more than 60 second to retrieve 1 record and if I execute the same query within the Query Analyzer, it...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.