Question

Define SQL views Q6(num1,num2,num3), which give the number of, respectively • distinct local stud...

Define SQL views Q6(num1,num2,num3), which give the number of, respectively • distinct local students enrolled in 10S1 in stream(s) named Chemistry. • distinct international students enrolled in 10S1 in programs offered by Faculty of Engineering. • all the distinct students enrolled in 10S1 in the Computer Science (3978) program. Note: • the student IDs are the UNSW ids (i.e. student numbers) defined in the People.unswid field. • Do not count duplicate records.

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

1.Create view student_view1 AS SELECT distinct *  FROM People where country='USA' AND enroll='10S1' AND stream='chemistry';

Note:Syntax of View is

CREATE VIEW VIEW_NAME AS SELECT column1,column2....FROM TABLE_Name;

So student_view1 is the view name and distinct keyword is used to select rows without duplication.

Country = 'USA' in where clause gives local students

2.Create view student_view2 AS SELECT distinct * FROM People where country != 'USA' AND enroll='10S1' AND stream='Faculty of Engineering';

Note:Same as above. But for international students,means students outside of USA and stream is faculty of engineering.

3.Create view student_view3 AS SELECT distinct * FROM People where enroll='10S1' AND stream='Computer Science';.

Note:For all students we do not specify the country. Only enroll and Stream are specified.

Add a comment
Know the answer?
Add Answer to:
Define SQL views Q6(num1,num2,num3), which give the number of, respectively • distinct local stud...
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