Rédigé par des étudiants ayant réussi Disponible immédiatement après paiement Lire en ligne ou en PDF Mauvais document ? Échangez-le gratuitement 4,6 TrustPilot
logo-home
Examen

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

Note
-
Vendu
-
Pages
5
Qualité
A+
Publié le
24-11-2024
Écrit en
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

Montrer plus Lire moins
Établissement
Sql
Cours
Sql

Aperçu du contenu

©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

École, étude et sujet

Établissement
Sql
Cours
Sql

Infos sur le Document

Publié le
24 novembre 2024
Nombre de pages
5
Écrit en
2024/2025
Type
Examen
Contenu
Questions et réponses

Sujets

9,80 €
Accéder à l'intégralité du document:

Mauvais document ? Échangez-le gratuitement Dans les 14 jours suivant votre achat et avant le téléchargement, vous pouvez choisir un autre document. Vous pouvez simplement dépenser le montant à nouveau.
Rédigé par des étudiants ayant réussi
Disponible immédiatement après paiement
Lire en ligne ou en PDF

Faites connaissance avec le vendeur

Seller avatar
Les scores de réputation sont basés sur le nombre de documents qu'un vendeur a vendus contre paiement ainsi que sur les avis qu'il a reçu pour ces documents. Il y a trois niveaux: Bronze, Argent et Or. Plus la réputation est bonne, plus vous pouvez faire confiance sur la qualité du travail des vendeurs.
TheStar Florida State University
S'abonner Vous devez être connecté afin de pouvoir suivre les étudiants ou les formations
Vendu
651
Membre depuis
2 année
Nombre de followers
180
Documents
25536
Dernière vente
3 jours de cela
Stuvia Prodigy

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

3,8

131 revues

5
58
4
25
3
25
2
4
1
19

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions