3.SQL-1

Created by Ode On

p.54

What do all other aggregate functions return when the collection has only null values?

Click to see answer

p.54

All other aggregates return null.

Click to see question

1 / 262
p.54
Handling Null Values

What do all other aggregate functions return when the collection has only null values?

All other aggregates return null.

p.5
SQL vs Relational Algebra

What is the de facto standard for accessing database systems today?

SQL.

p.51
Aggregate Functions in SQL

What is the minimum average salary specified in the HAVING clause?

p.31
Set Operations in SQL

What SQL query would you use to find course IDs for Spring 2010?

select course_id from section where semester = 'Spring' and year = 2010.

p.27
SQL Query Structure

What pattern is used to find names containing 's' in the instructor table?

'%s %'.

p.44
Handling Null Values

What is the result of 'unknown and false' in three-valued logic?

False.

p.10
SQL Query Structure

What do A_i and r_i represent in a SQL query?

A_i represents an attribute and r_i represents a relation.

p.48
Aggregate Functions in SQL

What is the purpose of the AVG function?

To find the average value.

p.14
SQL Query Structure

What SQL command is used to select specific columns from a table?

SELECT.

p.55
Aggregate Functions in SQL

What SQL clauses are used for grouping and filtering aggregate results?

GROUP BY, HAVING.

p.8
Aggregate Functions in SQL

What SQL clauses are used for grouping and filtering aggregate results?

GROUP BY, HAVING.

p.9
SQL Query Structure

What does the SELECT statement do in a SQL query?

Specifies the columns to be retrieved.

p.23
SQL Query Structure

What SQL command is used to select names from the instructor table?

SELECT name FROM instructor WHERE name LIKE 'Br%';

p.52
SQL Query Structure

Which columns are selected in the query?

dept_name and avg(salary).

p.32
SQL Basic Syntax

What does the asterisk (*) signify in the SELECT statement?

It selects all columns from the specified table.

p.21
String Operations in SQL

How can you find the length of a string in SQL?

You can use the LENGTH function to find the number of characters in a string.

p.30
Set Operations in SQL

What does the EXCEPT operation accomplish?

Returns rows from the first query that are not in the second query.

p.41
Set Operations in SQL

What course is associated with the SQL query?

LSGI3245 – Geospatial Database Management and Design.

p.53
Query Processing Steps

When are predicates in the HAVING clause applied?

After the formation of groups.

p.2
Relational Query Languages

What is a relational query language?

A language used to query and manipulate relational databases.

p.48
Aggregate Functions in SQL

What does the COUNT function return?

The number of values.

p.44
Handling Null Values

What does 'not unknown' evaluate to?

Unknown.

p.17
SQL Basic Syntax

What SQL command is used to retrieve all records from a table?

SELECT *

p.5
SQL vs Relational Algebra

What is the basis of SQL in terms of data handling?

Bags (allow duplicates).

p.9
SQL Query Structure

What is the role of the FROM clause in a SQL query?

Indicates the table from which to retrieve data.

p.2
SQL Basic Syntax

What is SQL?

Structured Query Language, used for managing and querying relational databases.

p.2
SQL vs Relational Algebra

What is relational algebra?

A formal system for manipulating relations in databases.

p.14
SQL Query Structure

What is the purpose of 'AS' in the SQL query?

To rename the resulting attribute, such as 'monthly_salary'.

p.34
Set Operations in SQL

How do you find courses that ran in both Fall 2009 and Spring 2010?

Use the INTERSECT operation between two SELECT queries for each semester.

p.14
SQL Query Structure

How do you calculate the monthly salary from an annual salary in SQL?

By dividing the salary by 12.

p.54
Handling Null Values

What does the statement 'Total all salaries' imply regarding null amounts?

It ignores null amounts.

p.15
SQL Query Structure

What SQL command is used to select distinct names of instructors?

SELECT DISTINCT T.name FROM instructor AS T, instructor AS S WHERE T.salary > S.salary AND S.dept_name = 'Comp. Sci.'

p.47
Aggregate Functions in SQL

What does the COUNT function do?

Counts the number of rows that match a specified condition.

p.8
SQL Basic Syntax

What SQL statements are used for pattern matching?

LIKE, ILIKE.

p.44
Handling Null Values

What is the result of any comparison with null?

It returns unknown.

p.20
SQL Query Structure

What does the BETWEEN operator include in its range?

It includes the boundary values (e.g., >= 90,000and<=90,000 and <= 100,000).

p.42
Handling Null Values

What happens when you perform arithmetic operations with null values?

The result is also null.

p.55
SQL Basic Syntax

What SQL statements are used for pattern matching?

LIKE, ILIKE.

p.16
SQL Query Structure

Provide an example of sorting by salary in descending order and name in ascending order.

order by salary desc, name asc.

p.5
SQL vs Relational Algebra

What does Relational Algebra consist of?

A set of operations used to manipulate and retrieve data.

p.28
String Operations in SQL

Provide an example of a string that matches '%Comp%'.

'Intro. To Comp uter Science' or 'Comp utational Data Science'.

p.50
SQL Query Structure

What is the purpose of the 'AS' keyword in the SQL query?

It is used to rename a column in the result set.

p.10
SQL Query Structure

What is the purpose of the from clause in a SQL query?

It lists the relations that the query takes as input.

p.27
SQL vs Relational Algebra

What is the course code mentioned in the text?

LSGI3245.

p.32
SQL Query Structure

What course is associated with the SQL query provided?

LSGI3245 – Geospatial Database Management and Design.

p.48
Aggregate Functions in SQL

What does the MIN function return?

The minimum value.

p.37
SQL Query Structure

What is the result of the query 'select distinct T.salary from instructor as T, instructor as S where T.salary < S.salary'?

It retrieves salaries from the instructor table that are less than other salaries in the same table.

p.21
String Operations in SQL

What is pattern matching in string operations?

Pattern matching is a technique used to search for specific patterns within strings, often using wildcard characters.

p.4
Database Keys

What is a superkey?

A set of one or more attributes that allows us to uniquely identify a tuple in a relation.

p.24
SQL Query Structure

What SQL command is used to select names from the instructor table that end with 'an'?

SELECT name FROM instructor WHERE name LIKE '% an';

p.40
Set Operations in SQL

What do set operations like union, intersect, and except do with duplicates?

They automatically eliminate duplicates.

p.26
SQL Query Structure

What SQL command is used to select names from the instructor table?

SELECT name FROM instructor.

p.19
SQL Query Structure

How are the results ordered in the SQL query?

By salary in descending order.

p.3
Relational Query Languages

What is the relation name mentioned in the example?

LSGI3245 – Geospatial Database Management and Design.

p.1
SQL Basic Syntax

What SQL command is used to create a new table?

CREATE TABLE.

p.22
String Operations in SQL

How would you find instructors whose names start with 'Br'?

Use the query: select name from instructor where name like 'Br%'.

p.33
SQL Query Structure

What course is associated with the course ID LSGI3245?

Geospatial Database Management and Design.

p.6
Query Processing Steps

What is the second step in query processing?

Optimization.

p.33
Set Operations in SQL

What SQL operation is used to combine results from two queries in this example?

UNION.

p.3
Relational Query Languages

What is an example of a relational database source?

p.18
SQL Query Structure

What SQL command is used to retrieve all records from the instructor table?

SELECT * FROM instructor.

p.49
Aggregate Functions in SQL

What SQL clause is used to group results by a specific column?

GROUP BY.

p.52
SQL Query Structure

What SQL clause is used to filter groups based on a condition?

HAVING.

p.25
SQL Query Structure

What is the difference between the two SQL queries provided?

The second query uses 'LIKE '%Ca %'' with a capital 'C'.

p.49
Aggregate Functions in SQL

How do you find the average salary of instructors in each department?

Use the query: SELECT dept_name, AVG(salary) AS ave_salary FROM instructor GROUP BY dept_name;

p.11
SQL Basic Syntax

What is the focus of the course LSGI3245?

Geospatial Database Management and Design.

p.41
Set Operations in SQL

What are the conditions for the first SELECT statement in the provided SQL query?

semester = 'Fall' and year = 2009.

p.28
String Operations in SQL

What does the pattern 'Intro%' match?

Any string beginning with 'Intro'.

p.49
Aggregate Functions in SQL

What does the AVG function do in SQL?

Calculates the average value of a specified column.

p.37
SQL Query Structure

What does the SQL query 'select distinct T.salary from instructor as T' do?

It retrieves unique salary values from the instructor table.

p.43
Handling Null Values

Provide an example SQL query to find instructors with a null salary.

SELECT name FROM instructor WHERE salary IS NULL.

p.13
SQL Query Structure

What SQL clause is used to rename attributes in a query?

AS clause.

p.45
SQL Query Structure

What SQL command is used to select all records from the instructor table?

SELECT * FROM instructor;

p.46
SQL Query Structure

What is the purpose of the SQL statement 'SELECT * FROM instructor WHERE salary < 60000'?

It retrieves all records from the instructor table where the salary is less than 60,000.

p.13
SQL Query Structure

What is the significance of the WHERE clause in the query?

It filters results to only include instructors and students from the 'Comp. Sci.' department.

p.35
SQL Query Structure

What SQL command is used to retrieve course_id, semester, and year from the section table?

SELECT course_id, semester, year FROM section.

p.36
Set Operations in SQL

How can you find the salaries of all instructors that are less than the largest salary?

Use a query that selects distinct T.salary from instructor as T, instructor as S where T.salary < S.salary.

p.43
Handling Null Values

What is the result of any arithmetic expression involving null?

The result is null.

p.52
Aggregate Functions in SQL

What function is used to calculate the average salary in the query?

AVG.

p.36
Set Operations in SQL

What SQL query retrieves all salaries of instructors?

Select distinct salary from instructor.

p.12
SQL Basic Syntax

What happens when an arithmetic expression is used in the select clause?

The resultant attribute does not have a name.

p.35
SQL Query Structure

What are the conditions used to filter the results for Spring 2010?

semester = 'Spring' AND year = 2010.

p.41
Set Operations in SQL

What are the conditions for the second SELECT statement in the provided SQL query?

semester = 'Spring' and year = 2010.

p.12
SQL Basic Syntax

What is a reason for replacing a long relation name in SQL?

To use a shortened version that is more convenient in the query.

p.35
Set Operations in SQL

What SQL operation is used to find common course_ids between two semesters?

INTERSECT.

p.52
SQL Query Structure

What is the condition for the average salary in the HAVING clause?

Average salary must be greater than 80000.

p.24
SQL Query Structure

What SQL command is used to select names from the instructor table that contain 'an'?

SELECT name FROM instructor WHERE name LIKE '% an%';

p.54
Aggregate Functions in SQL

What is the SQL command to sum salaries from the instructor table?

select sum(salary) from instructor.

p.48
Aggregate Functions in SQL

Write a SQL query to find the average salary of instructors in the computer science department.

SELECT AVG(salary) FROM instructor WHERE dept_name = 'Comp. Sci.';

p.44
Handling Null Values

When does 'P is unknown' evaluate to true?

If predicate P evaluates to unknown.

p.9
SQL Query Structure

What is the function of the WHERE clause in a SQL query?

Filters records based on specified conditions.

p.34
Set Operations in SQL

What SQL command is used to find courses that ran in Fall 2009 but not in Spring 2010?

Use the EXCEPT operation between the SELECT queries for Fall 2009 and Spring 2010.

p.17
SQL Query Structure

Which table is being queried in the SQL statement?

instructor

p.34
Set Operations in SQL

What course is mentioned in the context of the SQL queries?

LSGI3245 – Geospatial Database Management and Design.

p.44
Handling Null Values

How is the result of a WHERE clause predicate treated if it evaluates to unknown?

It is treated as false.

p.14
SQL Query Structure

What does the query 'SELECT ID, name, salary/12 AS monthly_salary FROM instructor' do?

It selects the ID, name, and calculates the monthly salary from the instructor table.

p.38
SQL Query Structure

What is the main topic of discussion regarding instructors' salaries?

Finding another way to get the largest salary of all instructors.

p.38
SQL Query Structure

What course is associated with the discussion on instructors' salaries?

LSGI3245 – Geospatial Database Management and Design.

p.6
Query Processing Steps

What is the final step in query processing?

Evaluation.

p.33
SQL Query Structure

What are the semesters specified in the SQL query?

Fall 2009 and Spring 2010.

p.45
Handling Null Values

What does the 'IS NULL' condition check for in SQL?

It checks for records where the specified column has no value.

p.18
SQL Query Structure

How are the results ordered in the SQL query?

By dept_name and name.

p.3
Database Keys

What is a primary key in a relational database?

A unique identifier for a record in a table.

p.30
Set Operations in SQL

Name the primary set operations in SQL.

UNION, INTERSECT, and EXCEPT.

p.55
SQL Query Structure

What are the basic components of SQL queries?

Select, from, where.

p.21
String Operations in SQL

What is concatenation in string operations?

Concatenation is the operation of joining two or more strings together to form a single string.

p.15
SQL Query Structure

What SQL operation is used to compare tuples in the same relation?

Using a self-join to compare salaries of instructors.

p.4
Database Keys

What defines a candidate key?

A set of superkeys for which no proper subset is a superkey.

p.17
SQL Query Structure

What is the purpose of the 'ORDER BY' clause in SQL?

To sort the results by a specified column.

p.14
SQL Query Structure

What is the significance of renaming attributes in SQL?

It improves readability and clarity of the result set.

p.34
Set Operations in SQL

What is the SQL query to find courses in Spring 2010?

SELECT course_id FROM section WHERE semester = 'Spring' AND year = 2010.

p.17
SQL Query Structure

Which column is used to sort the results in the given SQL query?

name

p.17
Relational Query Languages

What does 'LSGI3245' refer to in the context provided?

It is a course code for Geospatial Database Management and Design.

p.4
Database Keys

What is a primary key?

A candidate key chosen by the database designer as the principal means of identifying tuples within a relation.

p.6
Query Processing Steps

What is the first step in query processing?

Parsing and translation.

p.13
SQL Query Structure

What is the purpose of using 'AS' in the query?

To rename duplicated attribute names.

p.22
String Operations in SQL

What operator does SQL use for string matching?

The operator 'like'.

p.19
SQL Query Structure

What SQL command is used to retrieve all records from the instructor table?

SELECT * FROM instructor.

p.45
Handling Null Values

What condition is applied to filter records in the given SQL query?

WHERE salary IS NULL;

p.56
Relational Query Languages

What is a relational model?

A relational model is based on a collection of tables that users can query, insert, delete, and update.

p.25
SQL Query Structure

What condition is used to filter names in the first SQL query?

WHERE name LIKE '%ca %'.

p.51
Aggregate Functions in SQL

What does the HAVING clause do in SQL?

It filters groups after the formation of groups.

p.42
Handling Null Values

What are null values in a database?

Null values represent missing or undefined data.

p.31
Set Operations in SQL

What SQL operations correspond to the mathematical set operations?

Union, intersect, and except correspond to ∪, ∩, and −.

p.1
SQL Basic Syntax

Which SQL command is used to retrieve data from a database?

SELECT.

p.43
Handling Null Values

How can you check for null values in SQL?

Using the predicate 'is null'.

p.50
Aggregate Functions in SQL

What SQL clause is used to group results by a specific column?

GROUP BY.

p.39
SQL Query Structure

What does the 'ORDER BY salary DESC' clause do in the SQL query?

It sorts the results by salary in descending order.

p.46
SQL Query Structure

What does the SQL statement 'SELECT * FROM instructor WHERE salary IS NULL' do?

It retrieves all records from the instructor table where the salary is null.

p.22
String Operations in SQL

What does the percent (%) character do in SQL string matching?

It matches any substring.

p.19
SQL Query Structure

What does 'ORDER BY salary DESC' do in SQL?

It sorts the results by the salary column from highest to lowest.

p.29
String Operations in SQL

What is the purpose of the escape character in SQL?

To indicate that a special pattern character should be treated as a normal character.

p.13
SQL Query Structure

What type of join is implied by the use of instructor and student in the query?

Cartesian product (cross join) without explicit join conditions.

p.27
SQL Query Structure

What SQL command is used to select names from the instructor table?

SELECT name FROM instructor.

p.56
Database Keys

What are the important concepts associated with the relational model?

Relation schema & instance, attributes, and keys.

p.29
String Operations in SQL

What escape character is used in the provided examples?

Backslash ().

p.31
Set Operations in SQL

How do you find courses that ran in Fall 2009 or Spring 2010 using SQL?

Use the union of two select statements for each semester.

p.52
SQL Query Structure

What is the purpose of the GROUP BY clause in the query?

To group the results by department name.

p.36
Set Operations in SQL

How do you find the largest salary of all instructors?

By using a query that compares salaries in the instructor table.

p.55
SQL Basic Syntax

What SQL statement is used for renaming operations?

AS.

p.48
Aggregate Functions in SQL

What do aggregate functions operate on?

The multiset of values of a column of a relation.

p.20
SQL Query Structure

What is an equivalent SQL expression to using the BETWEEN operator for salary?

SELECT DISTINCT name FROM instructor WHERE salary >= 90000 AND salary <= 100000.

p.42
Handling Null Values

How can you check for null values in SQL?

Using the IS NULL or IS NOT NULL condition in a query.

p.8
SQL Basic Syntax

Which SQL statements are used for ordering tuples?

ORDER BY, ASC, DESC.

p.16
SQL Query Structure

How can you sort on multiple attributes in SQL?

By using a comma-separated list in the order by clause, e.g., order by dept_name, name.

p.2
Database Keys

What does data abstraction refer to in a database context?

The process of hiding the complexities of the database from users.

p.23
SQL Query Structure

What does the 'LIKE' operator do in SQL?

It is used to search for a specified pattern in a column.

p.9
SQL Query Structure

What is the primary purpose of a basic query structure in SQL?

To retrieve data from a database.

p.5
SQL vs Relational Algebra

How is Relational Algebra useful in query evaluation?

It serves as an internal representation for query evaluation plans.

p.23
SQL Query Structure

What does 'Br%' signify in the SQL query?

It signifies that the name should start with 'Br'.

p.15
SQL Query Structure

How can you rename relations in SQL?

By using the 'AS' keyword to create an alias for the relation.

p.47
Aggregate Functions in SQL

What is the purpose of the AVG function?

Calculates the average value of a numeric column.

p.44
Handling Null Values

What is the result of the expression '5 < null'?

Unknown.

p.2
Database Keys

What is a data model?

A conceptual representation of data structures.

p.55
Set Operations in SQL

Which SQL statements are used for set operations?

UNION, INTERSECT, EXCEPT.

p.28
String Operations in SQL

What does the pattern '___' match?

Any string of exactly three characters.

p.40
Set Operations in SQL

What is the purpose of using 'union all', 'intersect all', and 'except all'?

To retain all duplicates.

p.28
String Operations in SQL

What does the pattern '___%' match?

Any string of at least three characters.

p.47
Aggregate Functions in SQL

How does the SUM function work?

Adds up all the values in a numeric column.

p.9
SQL Query Structure

What are the main components of a basic SQL query?

SELECT, FROM, WHERE.

p.44
Handling Null Values

What is the result of 'unknown or true' in three-valued logic?

True.

p.13
SQL Query Structure

What is the result of the query selecting instructor and student names?

It retrieves names of instructors and students from the 'Comp. Sci.' department.

p.25
SQL Query Structure

What SQL command is used to select names from the instructor table?

SELECT name FROM instructor.

p.37
SQL Basic Syntax

What does the 'distinct' keyword do in SQL?

It ensures that the results returned are unique, eliminating duplicates.

p.50
Aggregate Functions in SQL

What is the output of the query that finds the average salary of instructors?

It returns the department name and the average salary of instructors in that department.

p.10
SQL Query Structure

What do the where and select clauses do in a SQL query?

They specify how to operate on the relations listed in the from clause.

p.8
Set Operations in SQL

Which SQL statements are used for set operations?

UNION, INTERSECT, EXCEPT.

p.5
SQL vs Relational Algebra

What type of language is SQL?

Non-procedural (only specifies what data are needed).

p.10
SQL Query Structure

What does a SQL query produce as a result?

It produces a relation as the result.

p.15
SQL Query Structure

What SQL query retrieves instructor names and course IDs where instructor ID is greater than course ID?

SELECT T.name, S.course_id FROM instructor AS T, teaches AS S WHERE T.ID > S.ID

p.5
SQL vs Relational Algebra

What type of language is Relational Algebra?

Procedural (specifies both what data are needed and how to get those data).

p.27
SQL vs Relational Algebra

What is the course title associated with LSGI3245?

Geospatial Database Management and Design.

p.48
Aggregate Functions in SQL

What does the MAX function return?

The maximum value.

p.54
Handling Null Values

What happens to null values in aggregate operations?

All aggregate operations except count(*) ignore tuples with null values on the aggregated attributes.

p.15
SQL Query Structure

What is the purpose of renaming relations in SQL?

To replace a long relation name with a shortened version for easier reference.

p.55
Aggregate Functions in SQL

What are some aggregate functions in SQL?

AVG, MIN, MAX, SUM, COUNT.

p.8
Aggregate Functions in SQL

What are some aggregate functions in SQL?

AVG, MIN, MAX, SUM, COUNT.

p.12
SQL Basic Syntax

What SQL clause is used for renaming attributes and relations?

The 'AS' clause.

p.33
SQL Query Structure

What is the purpose of the SQL query provided?

To select course IDs from sections offered in specific semesters and years.

p.26
String Operations in SQL

How does the 'LIKE' operator treat case sensitivity in SQL?

String operations are case sensitive.

p.1
Relational Query Languages

What is relational algebra?

A type of relational query language.

p.29
String Operations in SQL

How can you include the special characters '%' or '_' in SQL patterns?

By using an escape character before them.

p.22
String Operations in SQL

What does the underscore (_) character do in SQL string matching?

It matches any single character.

p.56
Relational Query Languages

What does the term 'relation' refer to in the relational model?

The term 'relation' refers to a table.

p.12
SQL Basic Syntax

Why might we need to use the rename operation in SQL?

To avoid attribute name duplication in the result.

p.32
Set Operations in SQL

What SQL operation is used to combine results from two SELECT statements?

UNION.

p.18
SQL Query Structure

What is the course code mentioned in the text?

LSGI3245.

p.42
Handling Null Values

How do null values differ from zero or empty strings?

Null values indicate the absence of a value, while zero and empty strings are actual values.

p.3
Database Keys

What is a foreign key?

An attribute that creates a link between two tables.

p.32
SQL Query Structure

What semesters are being selected in the provided SQL query?

Fall 2009 and Spring 2010.

p.26
SQL Query Structure

What is the purpose of the 'LIKE' operator in SQL?

To search for a specified pattern in a column.

p.43
Handling Null Values

What does a null value signify in a tuple?

An unknown value or that a value does not exist.

p.30
Set Operations in SQL

What are set operations in SQL?

Operations that combine the results of two or more queries.

p.41
Set Operations in SQL

What SQL operation is used to combine results from two SELECT statements?

UNION ALL.

p.35
SQL Query Structure

What are the conditions used to filter the results for Fall 2009?

semester = 'Fall' AND year = 2009.

p.51
Aggregate Functions in SQL

How does the HAVING clause differ from the WHERE clause?

HAVING is applied after groups are formed, while WHERE is applied before grouping.

p.23
SQL Query Structure

What type of data is being queried in the provided SQL statement?

Names from the instructor table.

p.47
Aggregate Functions in SQL

What does the MAX function return?

The maximum value in a set of values.

p.48
Aggregate Functions in SQL

What does the SUM function calculate?

The sum of values.

p.21
String Operations in SQL

What are string operations in SQL?

String operations in SQL are functions that manipulate string data types, allowing for tasks such as concatenation, substring extraction, and pattern matching.

p.20
SQL Query Structure

What SQL operator is used for range comparisons?

The BETWEEN comparison operator.

p.16
SQL Query Structure

How can you list the names of all instructors in alphabetical order?

Use the query: select distinct name from instructor order by name.

p.27
SQL Basic Syntax

What does the ILIKE operator do in SQL?

Makes the match case insensitive.

p.51
Aggregate Functions in SQL

What SQL query finds departments with an average salary greater than 80000?

SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name HAVING AVG(salary) > 80000.

p.20
SQL Query Structure

How can you find instructors with a salary between 90,000and90,000 and 100,000 using SQL?

SELECT DISTINCT name FROM instructor WHERE salary BETWEEN 90000 AND 100000.

p.2
Database Keys

What does DBMS stand for?

Database Management System.

p.8
SQL Basic Syntax

What SQL statement is used for renaming operations?

AS.

p.41
Set Operations in SQL

What is the purpose of the SQL query provided?

To retrieve course IDs from two different semesters and years.

p.39
SQL Query Structure

What SQL command is used to select the highest salary from the instructor table?

SELECT salary FROM instructor ORDER BY salary DESC LIMIT 1.

p.53
SQL Query Structure

What does the SQL query select from the instructor table?

dept_name and the average salary.

p.25
SQL Query Structure

What does the '%' symbol represent in the SQL LIKE clause?

It represents zero or more characters.

p.1
SQL Query Structure

What is the purpose of the 'FROM' clause in SQL?

To specify the table from which to retrieve data.

p.26
String Operations in SQL

What pattern is being searched for in the instructor names?

'%ca %' and '%Ca %'.

p.54
Handling Null Values

What does the count function return when the collection has only null values?

Count returns 0.

p.2
Database Keys

What is the primary focus of LSGI3245?

Geospatial Database Management and Design.

p.8
SQL Query Structure

What are the basic components of SQL queries?

Select, from, where.

p.11
SQL Query Structure

What type of operations are covered in the course?

Basic operations related to geospatial databases.

p.30
Set Operations in SQL

What does the UNION operation do?

Combines the results of two queries and removes duplicates.

p.18
SQL Query Structure

What is the title of the course associated with the code LSGI3245?

Geospatial Database Management and Design.

p.53
SQL Query Structure

What is the condition for salaries in the WHERE clause of the SQL query?

Salaries must be less than 80000.

p.16
SQL Query Structure

What keyword is used to specify descending order in SQL?

desc.

p.47
Aggregate Functions in SQL

What are aggregate functions in SQL?

Functions that perform a calculation on a set of values and return a single value.

p.42
Handling Null Values

What is a common issue when querying null values?

Null values can lead to unexpected results in comparisons and aggregations.

p.3
Database Keys

What does the foreign key reference in the example?

The department table.

p.29
String Operations in SQL

What does the pattern 'ab \ %cd%' match?

All strings beginning with 'ab%cd'.

p.28
String Operations in SQL

Give an example of a string that matches 'Intro%'.

'Intro duction' or 'Intro vert'.

p.50
Aggregate Functions in SQL

What does the AVG function do in SQL?

Calculates the average value of a specified column.

p.5
SQL vs Relational Algebra

What does SQL consist of?

Both DDL (Data Definition Language) and DML (Data Manipulation Language).

p.39
SQL Query Structure

What is the purpose of the 'LIMIT 1' clause in the SQL query?

It restricts the result to only the highest salary.

p.10
SQL Query Structure

What is the typical form of a SQL query?

select A1, A2, ..., An from r1, r2, ..., rm where P.

p.49
SQL Query Structure

What is the purpose of the 'AS' keyword in the SQL query?

It is used to rename a column in the result set.

p.51
Aggregate Functions in SQL

What is the purpose of the AVG function in the provided SQL query?

To calculate the average salary of each department.

p.53
SQL Query Structure

What is the purpose of the HAVING clause in the SQL query?

To filter groups having an average salary greater than 80000.

p.27
SQL Query Structure

What pattern is used to find names containing 'ca' in the instructor table?

'%ca %'.

p.31
Set Operations in SQL

What SQL query would you use to find course IDs for Fall 2009?

select course_id from section where semester = 'Fall' and year = 2009.

p.30
Set Operations in SQL

What is the purpose of the INTERSECT operation?

To return only the rows that are common to both queries.

p.12
SQL Basic Syntax

When might we want to compare tuples in the same relation?

When using the rename operation.

p.35
Relational Query Languages

What is the course_id for Geospatial Database Management and Design?

LSGI3245.

p.37
SQL Query Structure

What does the condition 'T.salary < S.salary' signify in the SQL query?

It filters the results to include only those salaries that are less than another salary.

p.31
Set Operations in SQL

What is the result of using the union operation in SQL?

It combines the results of two queries, removing duplicates.

p.53
Query Processing Steps

When are predicates in the WHERE clause applied?

Before forming groups.

p.32
SQL Query Structure

What is the purpose of the WHERE clause in the SQL query?

To filter records based on specific conditions.

p.21
String Operations in SQL

What function is commonly used to extract a substring in SQL?

The SUBSTRING function is commonly used to extract a substring from a string.

p.37
Set Operations in SQL

What is the purpose of the 'except' clause in the SQL query?

It returns the distinct salaries from the first query that are not present in the second query.

p.47
Aggregate Functions in SQL

Can you name a common aggregate function?

SUM, AVG, COUNT, MAX, MIN.

p.16
SQL Query Structure

What is the default order for sorting attributes in SQL?

Ascending order (asc).

p.15
SQL Query Structure

How can you find instructors with a higher salary than at least one instructor in Computer Science?

By using a self-join and a condition on salary and department.

p.1
SQL Query Structure

What does the 'WHERE' clause do in an SQL query?

It filters records based on specified conditions.

p.36
Set Operations in SQL

What does the 'except' clause do in SQL?

It returns all distinct salaries from the second query that are not in the first query.

p.43
Handling Null Values

What is the SQL representation of a null value?

It is denoted by 'null'.

p.44
Handling Null Values

What are the three values in three-valued logic?

True, false, and unknown.

p.49
SQL Query Structure

What table is referenced in the query for finding average salaries?

The instructor table.

p.2
Database Keys

What is the role of database engines?

To manage and communicate with the database.

p.50
Aggregate Functions in SQL

How can you find the average salary of instructors in each department?

Use the query: SELECT dept_name, AVG(salary) AS ave_salary FROM instructor GROUP BY dept_name;

p.29
String Operations in SQL

What does the pattern 'ab \ \ cd%' match?

All strings beginning with 'ab \ cd'.

p.55
SQL Basic Syntax

Which SQL statements are used for ordering tuples?

ORDER BY, ASC, DESC.

p.28
String Operations in SQL

What does the pattern '%Comp%' match?

Any string containing 'Comp' as a substring.

p.2
Relational Query Languages

What is the relational model used for?

Data processing in databases.

p.10
SQL Query Structure

Provide an example of a SQL query.

select name from instructor where dept_name = 'Comp. Sci.'

p.47
Aggregate Functions in SQL

What does the MIN function return?

The minimum value in a set of values.

p.5
SQL vs Relational Algebra

What is the basis of Relational Algebra in terms of data handling?

Sets (no duplicates).

p.34
Set Operations in SQL

What is the SQL query to find courses in Fall 2009?

SELECT course_id FROM section WHERE semester = 'Fall' AND year = 2009.

Study Smarter, Not Harder
Study Smarter, Not Harder