Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Maverick_
Posting Yak Master
107 Posts |
Posted - 2010-02-12 : 06:24:23
|
| Hello allI am trying to think of ways in which I could explain the concept of what SELECT, FROM, and WHERE statements using real life examples. The reason why is because some users want to learn SQL and they are not the most technical computing people, some of them are only coming across coding for the first time in their careers.So my thought was to get them away from the subject they have to use it for and more towards a real life example as part of introduction.One comparison I had was of going shopping:SELECT represents general items you are looking for, for example this Sunday you are out shopping and are looking for Shoes, Ties, and Shampoo.FROM represents where you want to buy it from, so this could be Shoe Locker for shoes, Moss for Ties, and Boots for Shampoo.WHERE represents particular preferences you have. You want Shoes that are made by the likes Nike, Adidas, or Vivenne Westwood, and leather material. You want ties made from Woven Silk only, and the Shampoo must be made from natural sources.Would this be a good example? What do you guys think? Any suggestions welcome :) |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-12 : 08:00:32
|
How are you going to JOIN Shoe Locker, Moss, and Boots? I would take a business example that the audience is familiar with - Customers, Products, Orders, Order Items - i.e. tables that inter-relate. Employee / Department / Company division. Seeds, Type (Vegetable / Flower / Tree), Category, ... |
 |
|
|
MrQuizzles
Starting Member
20 Posts |
Posted - 2010-02-12 : 16:54:25
|
I almost always use chairs when relating computing concepts to people (especially good for polymorphism).Say you go to a furniture store. There's a lot of chairs there, but you're looking for certain characteristics in your chair. You want a recliner, and you want it to be beige to match your decor. You also feel that leather would be a nice touch, but you don't want it to cost more than $700.So our query would look like:SELECT * FROM furniture_store_chairs WHEREstyle = 'recliner'AND color = 'beige'AND material = 'leather'AND price < 700; |
 |
|
|
|
|
|
|
|