Question

If you were building a database table that contains the following attributes/fields: date, social security number,...

  1. If you were building a database table that contains the following attributes/fields: date, social security number, and phone number fields, how would you define each field (char, text or numeric, et.) and why?

2) Explain how and when it is appropriate to use the following SQL clauses/statements:
   a. GROUP BY vs. ORDER BY
   b. WHERE vs. HAVING

0 0
Add a comment Improve this question Transcribed image text
Answer #1

date = date

social security number = varchar2

phone = number

________________

GROUP BY VS ORDER BY

Group By : This will summarize unique combination of column values.

Order by : This is used to sort and display the data based on the specified columns.

See here it is displaying the product table data based on the column name in sorting order(ascending order by default) .

______________________

Where vs Having:

Where : this is used to display the data based on the condition specified in the where clause.The Difference between where and having is , we cannot use "where" clause on the aggregates by we can use "having" on aggregates.

In general we have to use "where" before "group by" but we have to use "Having" after "group by".Thats why we call "where" as a pre-filter and "Having" as a post filter.

_____________________Thank You

Add a comment
Know the answer?
Add Answer to:
If you were building a database table that contains the following attributes/fields: date, social security number,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT