100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

5. SQL - Queries, Programming, Triggers. Exam Questions With Verified And Updated Answers

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
24-11-2024
Written in
2024/2025

©THESTAR EXAM SOLUTIONS 2024/2025 ALL RIGHTS RESERVED. 1 | P a g e 5. SQL - Queries, Programming, Triggers. Exam Questions With Verified And Updated Answers What are the parts of a basic SQL query? - answerSELECT [DISTINCT] target-list FROM relation-list WHERE qualification relation-list - answerA list of relation names (possibly with a range-variable after each name). target-list - answerA list of attributes of relations in relation-list qualification - answerComparisons (Attr op const or Attr1 op Attr2, where op is one of <, >, =, <=, >=, != ) combined using AND, OR and NOT. DISTINCT - answeris an optional keyword indicating that the answer should not contain duplicates. Default is that duplicates are not eliminated! Are the input and result tables of an SQL query sets or multisets? - answerIf not using DISTINCT, the result tables are a set, else, multiset. How can you obtain a set of tuples as the result of a query? - answerTables are multisets of tuples. What are range variables in SQL? - answerReally needed only if the same relation appears twice in the FROM clause. It is good style, however, to use range variables always! SELECT S.sname FROM Sailors S, Reserves R WHERE S.sid=R.sid AND bid=103

Show more Read less
Institution
Sql
Course
Sql









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Sql
Course
Sql

Document information

Uploaded on
November 24, 2024
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

©THESTAR EXAM SOLUTIONS 2024/2025

ALL RIGHTS RESERVED.



5. SQL - Queries, Programming, Triggers.
Exam Questions With Verified And Updated
Answers

What are the parts of a basic SQL query? - answer✔SELECT [DISTINCT] target-list
FROM relation-list
WHERE qualification

relation-list - answer✔A list of relation names (possibly with a range-variable after each name).

target-list - answer✔A list of attributes of relations in relation-list

qualification - answer✔Comparisons (Attr op const or Attr1 op Attr2, where op is one of <, >, =,
<=, >=, != ) combined using AND, OR and NOT.

DISTINCT - answer✔is an optional keyword indicating that the answer should not contain
duplicates. Default is that duplicates are not eliminated!

Are the input and result tables of an SQL query sets or multisets? - answer✔If not using
DISTINCT, the result tables are a set, else, multiset.

How can you obtain a set of tuples as the result of a query? - answer✔Tables are multisets of
tuples.

What are range variables in SQL? - answer✔Really needed only if the same relation appears
twice in the FROM clause. It is good style, however, to use range variables always!




SELECT S.sname
FROM Sailors S, Reserves R
WHERE S.sid=R.sid AND bid=103



1|Page

, ©THESTAR EXAM SOLUTIONS 2024/2025

ALL RIGHTS RESERVED.
How can you give names to output columns in a query that are defined by arithmetic or string
expressions? - answer✔Each item in a select-list can be of the form expression AS
column_name, where expression is any arithmetic or string expression over column names
(possibly prefixed by range variables) and constants, and column_name
is a new name for this column in the output of the query.


SELECT S.age, age1=S.age-5, 2*S.age AS age2
FROM Sailors S
WHERE S.sname LIKE 'B_%B'

What support does SQL offer for string pattern matching? - answer✔SQL provides support for
___________ through the LIKE operator, along with the use of the wild-card symbols % (which
stands for zero or more arbitrary characters) and ~ (which stands for exactly one, arbitrary,
character). Thus, '_AB%' denotes a ___________ every string that contains at least three
characters, with the second and third characters being A and B respectively.
What operations does SQL provide over (multi)sets of tuples, and how would you use these in
writing queries? - answer✔UNION, INTERSECT, and EXCEPT

What are nested queries? - answer✔A very powerful feature of SQL: a WHERE clause can itself
contain an SQL query! (Actually, so can FROM and HAVING clauses.)


Find names of sailors who have reserved boat #103:
SELECT S.sname
FROM Sailors S
WHERE S.sid IN (SELECT R.sid
FROM Reserves R
WHERE R.bid=103)

What is correlation in nested queries? - answer✔SELECT S.sname
FROM Sailors S
WHERE NOT EXISTS (( SELECT B.bid
FROM Boats B )

2|Page

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TheStar Florida State University
View profile
Follow You need to be logged in order to follow users or courses
Sold
589
Member since
1 year
Number of followers
178
Documents
23565
Last sold
5 hours ago
Stuvia Prodigy

Tested, Verified and Updated Study Materials with 100% Guaranteed Success.

3.8

117 reviews

5
56
4
21
3
20
2
3
1
17

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions