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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 need help regarding the following sql queries

Author  Topic 

nomiqw
Starting Member

2 Posts

Posted - 2006-12-15 : 19:48:13
hi all i am very new to Sql and i am on process of learning SQL Queries i need to know what will be the sql commands if i wanted the following options ( all tables are created perfect just need to know these commands)
Options
1. Calculate the summation of the column 'price' (as Sum).
Present the information in the following format; 'The sum is', 'Sum'

2. Calculate the minimum, median and maximum values of the column 'price'
Present the information in the following format;
'The minimum is' 'minimum', 'The median is' 'median', 'The maximum is' 'maximum',

3. Calculate the summation of the prices for items ItemID = 10, 11, 15 and 22. (as Sum).
Present the information in the following format; 'The sum is', 'Sum'

4. Select all items with 'Power meter' in the 'Description' field.
Present the information in the following format;
ItemID, Price, Description

5. List all data from 'mainTable' in ascending order by category.
Present the information in the following format;
ItemID, category (from category.Name).

6. List all data from 'mainTable' that has the word 'battery' in it anywhere.
Present the information in the following format;
ItemID, Title (consists of 'brand.Name Model briefDescription.Name'), Price.

7. Count the number of items in the table 'mainTable'. (as count)
Present the information in the following format; 'Count is count)

8. List all the information saved in all the provided tables.
Present the information in the following format;
ItemID, Category, price, Title (consists of 'brand.Name Model briefDescription.Name'), image, description, ship_code, Price_Discount, price_tax, Shipping_Discount, Shipping_tax

9. List all data from 'mainTable' in ascending order by category
Present the information in the following format;
ItemID, Title (consists of 'brand.Name Model briefDescription.Name'), SalePrice

SalePrice is calculated using the logical operation;
if Price > 440 AND Price < 1000 then use discount '10%';
if Price >= 1000 then use discount '12%'.
Calculation can be based on [Price * 1.1] for items between 440 and 1000, and [Price * 1.12] for items above 1000.

Please if you can provide SQL commands will be great
so i can work on them as i am new to all this all of your guys help is much appreciated
Thank you in advance to every one


nomi

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-15 : 22:20:18
If you learn SQL, you will be able to answer those questions

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nomiqw
Starting Member

2 Posts

Posted - 2006-12-16 : 06:56:09
thankyou for pointing me at right direction

nomi
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-16 : 07:01:13
Also regularly read the topics posted at this forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -