Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show all Customers through SQL 1

Status
Not open for further replies.

iambob

Programmer
Apr 13, 2021
41
0
0
US
I'm trying to list different people for an example program in SQL.

SELECT * From Customers;

I'm a beginner and just started SQL

Sincerely,
Bob Space
 
The query you should will return every record in the Customers table. I think you're saying you only want distinct customers. In a well-designed database, that should be every record, but you can eliminate exact duplicates by adding the DISTINCT keyword:

SELECT DISTINCT * FROM Customers;

However, in the real world, the kind of duplication you get in a customer table isn't as simple as exact duplicates. It's having one record for Bob Space and another for Robert Space and a third for R. Space. This is a business problem, not a database problem and there's no simple query that's going to solve it for you.

If I haven't answered the right query, please explain what you were trying to ask.

Tamar
 
Your Select statement will give you ALL fields for ALL people in your Customers table.
Unless you have other requirements "to list different people"... [ponder]

Usually the easiest way to ask a question is:
This is the data I have:
[tt]blah, blah, blah[/tt]
and this is what I would like to have as an output:
[tt]ABC, XYZ[/tt]



---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Yes, all fields for all people in the customers table. So that means it's right?

Sincerely,
Bob Space
 
Well, yes, it's right if you really want all fields from all customers. But you originally said you wanted "different people". As Tamar pointed out (above), if you have more than one record for a given customer, your query won't give you one row for that customer; it will give you all rows for the customer.

I suspect that the latter is what you want. When you said "different people", you really meant "all people". The problem is that when you are specifying the information you want to extract from a database, you have to mean ultra-precise. A word like "different" could make all the difference.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mike, by the way just a question are you fluent in Visual FoxPro?

Sincerely,
Bob Space
 
are you fluent in Visual FoxPro?

Bob, I don't know about fluent, but I do work with that language - as you can see from the discussions we have had recently in the VFP forum. Do you have a special reason for asking?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes, I'm interested in FoxPro, but it ended in 2003 so what is the use. Do you have a download for he software? I have never actually coded with the language, though. I can code in VBS (barely lol), APPLESOFT BASIC, and SQL.

Sincerely,
Bob Space
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top