What is the possible data type of the column ‘COL1’?

computer science

Description

Answer the following questions:

1.       What is the possible data type of the column ‘COL1’?

2.       What will the output of the following SQL statements be?

a.       ‘SELECT COUNT(*) AS ENTRIES FROM TABLE;’

b.      ‘SELECT COUNT(COL1) AS ENTRIES FROM TABLE;’

c.       ‘SELECT COUNT(DISTINCT COL1) AS ENTRIES FROM TABLE;’

3.       Write a query to fetch rows with values ranging from 0 to 2 (assuming the data type to be same as mentioned above)

 

 

 

 

 

Question 5: Consider the below table:

ord_no

purch_amt

ord_date

customer_id

salesman_id

70001

150.5

05-10-2012

3005

5002

70009

270.65

10-09-2012

3001

5005

70002

65.26

05-10-2012

3002

5001

70004

110.5

17-08-2012

3009

5003

70007

948.5

10-09-2012

3005

5002

70005

2400.6

27-07-2012

3007

5001

70008

5760

10-09-2012

3002

5001

70010

1983.43

10-10-2012

3004

5006

70003

2480.4

10-10-2012

3009

5003

70012

250.45

27-06-2012

3008

5002

70011

75.29

17-08-2012

3003

5007

70013

3045.6

25-04-2012

3002

5001

 

1.       Find out the number of orders booked and their total purchased amount for each day. The output should be in the below format:

a.       "For 2001-10-10 there are 15 orders and total amount is Rs.100"

2.       Find the total purchase amount at a customer salesman level and rank the salesmen based on the total sales done

3.       Find the orders with all the field in such a manner that, the oldest order date will come first and the highest purchase amount of same day will come first

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Question 6: Write a query in SQL to obtain the name of the physicians who are the head of each department. Use the below two tables

Sample table: physician

employee id

name

position

ssn

1

John Dorian

Staff Internist

111111111

2

Elliot Reid

Attending Physician

222222222

3

Christopher Turk

Surgical Attending Physician

333333333

4

Percival Cox

Senior Attending Physician

444444444

5

Bob Kelso

Head Chief of Medicine

555555555

6

Todd Quinlan

Surgical Attending Physician

666666666

7

John Wen

Surgical Attending Physician

777777777

8

Keith Dudemeister

MD Resident

888888888

9

Molly Clock

Attending Psychiatrist

999999999

 

Sample table: department

department id

name

head_employee_id

1

General Medicine

4

2

Surgery

7

3

Psychiatry

9

 

Output Table:

department id

dept_name

head_employee_name


Related Questions in computer science category

Get Higher Grades Now
Tutors Online

Get Free Quote!

290 Experts Online