Unit 10 : SQL ( Part 2 ) Flashcards

1
Q

What keyword do we need to add to make changes to table structure?

A
  1. ALTER
    • Add
    • Modify
    • Drop
  • It can be used to change data type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Some RDBMS ( Oracle ) do not permit changes to data types unless what?

A
  1. Column to be changed is empty
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What actions does some RDBMS impose restrictions on the deletion of an attribute?

A
  1. Use ALTER to drop down
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List out the useful functions that SQL provides

A
  1. Count
  2. Find minimum and maximun values
  3. Calculates averages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List out the aggregate functions

A
  1. Count
  2. Min
  3. Max
  4. Sum
  5. Avg
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a view?

A
  1. A virtual table based on SELECT query
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What can a view contain?

A
  1. Columns
  2. Computed Columns
  3. Aliases
  4. Aggregate Functions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can we create a view?

A
  1. Using CREATE VIEW to generate view
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the most important disrinction between relational database and other databases?

A
  1. Ability to combine ( join ) tables on common attributes ( primary keys )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When is JOIN performed?

A
  1. When data are retrieved from more than one table at a time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does JOIN is generally composed?

A
  1. Equality comparison between foreign key and primary key of related tables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What can alias be used to?

A
  1. Identify source source table
  • Any legal table name can be used as alias
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to join tables with alias?

A
  1. Use the FROM clause
    • FROM tablename alias
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is aggregate functions?

A
  1. Special functions that perform arithmetic computations over a set of rows
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the ORDER BY clause used to?

A
  1. Sort output of SELECT statement
  2. Can sort by one or more columns and use either an ascending or descending order
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When does Right Outer Join and Left Outer Join is used?

A
  1. Used to select rows that have no matching values in other related table
17
Q

How does Inner Join joins both tables?

A
  1. Returns rows where there is a match in both tables
18
Q

How does Left Join joins both tables?

A
  1. Returns all rows from the left table along with the matching rows from the right table
  • If records from left table doesn’t appear from right table, it will show NULL values
  • LEFT JOIN Orders
19
Q

How does Right Join joins both tables?

A
  1. Returns all rows from the right table along with the matching rows from the left table
  • If records from right table doesn’t appear from left table, it will show NULL values
20
Q

What JOINS does FULL JOIN combines? ( 2 )

A
  1. LEFT JOIN
  2. RIGHT JOIN
21
Q

How does Full Join ( Full Outer Join ) joins both tables?

A
  1. Returns all rows when there is a match in either the left or right table, if no match is found, NULL values are returned
22
Q
A