Podcast
Questions and Answers
Which SQL statement correctly updates the stock table when 100 items with code A1 are sold?
Which SQL statement correctly updates the stock table when 100 items with code A1 are sold?
- update stock set quantity=quantity - 100 having code=A1
- update stock set quantity=quantity - 100 where code=A1 (correct)
- update stock set quantity=100 where code=A1
- delete from stock set quantity=quantity - 100 where code=A1
What is the correct SQL statement to delete the product with code A1 from the stock table?
What is the correct SQL statement to delete the product with code A1 from the stock table?
- delete from stock where code=A1 (correct)
- delete from stock having code=A1
- drop from stock where code=A1
- update stock where code=A1
Which constraint should be used to ensure that an attribute always has a value?
Which constraint should be used to ensure that an attribute always has a value?
- Not null (correct)
- Unique
- Null
- Distinct
What is the correct syntax to create a view with the name 'v'?
What is the correct syntax to create a view with the name 'v'?
Which option is used to delete entries in the department table when a corresponding entry is deleted in the course table?
Which option is used to delete entries in the department table when a corresponding entry is deleted in the course table?
Which SQL statement is needed to update the stock table so that 100 items with code A1 are deducted from the quantity?
Which SQL statement is needed to update the stock table so that 100 items with code A1 are deducted from the quantity?
In order to successfully delete a record with code A1 from the stock table, which SQL statement should be used?
In order to successfully delete a record with code A1 from the stock table, which SQL statement should be used?
Which constraint ensures that an attribute in a database table cannot be left empty?
Which constraint ensures that an attribute in a database table cannot be left empty?
What is the correct syntax for creating a view named 'v' that executes a specific query?
What is the correct syntax for creating a view named 'v' that executes a specific query?
When deleting an entry in the course table, which option ensures that related entries in the department table are also removed?
When deleting an entry in the course table, which option ensures that related entries in the department table are also removed?
Flashcards
SQL UPDATE stock (quantity)
SQL UPDATE stock (quantity)
Used to decrease the quantity of a stock item (code A1) by 100.
SQL DELETE from stock (code A1)
SQL DELETE from stock (code A1)
Removes a product from the stock table. Removes the entire row with code A1.
NOT NULL constraint
NOT NULL constraint
Ensures an attribute has a value; it can't be empty.
SQL CREATE VIEW syntax
SQL CREATE VIEW syntax
Signup and view all the flashcards
ON DELETE CASCADE (in SQL)
ON DELETE CASCADE (in SQL)
Signup and view all the flashcards
SQL UPDATE stock for code A1
SQL UPDATE stock for code A1
Signup and view all the flashcards
SQL DELETE for code A1
SQL DELETE for code A1
Signup and view all the flashcards
NOT NULL constraint
NOT NULL constraint
Signup and view all the flashcards
SQL CREATE VIEW syntax
SQL CREATE VIEW syntax
Signup and view all the flashcards
ON DELETE CASCADE
ON DELETE CASCADE
Signup and view all the flashcards