Lecture 9- Other Features and Commands Flashcards
What type of query is this?
emp(sin, name, phone, city)
INSERT
What type of query is this?
emp(sin, name, phone, city)
Edmonton_phonebook(name, phone)
Bulk INSERT
What type of query is this?
R(a1,…an)
DELETE
What type of query is this?
R(a1,…,an)
UPDATE
What is this query doing?
customer(cname, street, city)
deposit(accno, cname, bname, balance)
Insert a new customer record for John Smith who lives on 345 Jasper Ave, Edmonton
What is this query doing?
customer(cname, street, city)
deposit(accno, cname, bname, balance)
Delete all customers who have less than $1000 in their accounts
What is this query doing?
customer(cname, street, city)
deposit(accno, cname, bname, balance)
Increase by 5% the balance of every customer who lives in Edmonton and has a balance of more than $5000
What is VIEW?
- View = query(~) = table
- A derived table whose definition, not the table itself is sorted
- Provides a degree of data independence
- Queried like a table
Create this query: create a view of customers who live in Jasper and name it Jasper customers
customer(cname, street, city)
Create this query: list the names of all customers in Jasper
customer(cname, street, city)
In queries, ____ is exactly like a base table
A VIEW
What is this query doing?
customer(cname, street, city)
deposit(accno, cname, bname, balance)
Create a view (called cust info) which gives for each customer the name, city, the number of deposit accounts awned and the total balance
What is this query doing?
customer(cname, street, city)
deposit(accno, cname, bname, balance)
Create a view (called deposit holders) which includes the name and the city of every deposit account holder
Views defined on ____ are generally not updatable
Multiple tables using joins
A view defined on a single table is updatable if?
The view attributes contain the primary key or some other candidate key
Views defined using ____ are not updatable
Aggregate functions
Each row and each column in an updatable view must?
Must correspond to a distinct row and column in a base table
SQLite only supports?
Only supports read-only views
Give an example of left outer join
Give an example of right inner join
Give an example of full outer join
Give an example of left outer join implementation in SQLite
What is an alternative syntax to left outer join?
- Join columns can have different names
- More general conditions are possible
- Two copies of column B
When is an unknown null value useful?
Useful when we don’t know a column value