SQL Querying Quiz
5 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which query can be used to display the unique promotion costs in each promotion category?

  • SELECT promo_category, MAX(promo_cost) FROM promotions GROUP BY promo_category;
  • SELECT promo_category, AVG(promo_cost) FROM promotions GROUP BY promo_category;
  • SELECT promo_category, SUM(promo_cost) FROM promotions GROUP BY promo_category;
  • SELECT DISTINCT promo_cost, promo_category FROM promotions ORDER BY promo_cost;
  • SELECT DISTINCT promo_category, promo_cost FROM promotions ORDER BY promo_category; (correct)

Which expression can be used to calculate the total price including surcharge and discount for a product?

  • unit_price + (surcharge * discount)
  • (unit_price * 0.15 / (4.75 + 552.25))
  • (unit_price * surcharge) - discount
  • unit_price + surcharge - discount (correct)
  • unit_price || 5 - discount + surcharge

Which query can be used to calculate the difference in days between the expiry date and delivery date for a product?

  • SELECT product_id, (expiry_date / delivery_date) AS days_difference FROM products;
  • SELECT product_id, EXTRACT(DAY FROM (expiry_date - delivery_date)) AS days_difference FROM products;
  • SELECT product_id, (expiry_date + delivery_date) AS days_difference FROM products;
  • SELECT product_id, DATEDIFF(day, delivery_date, expiry_date) AS days_difference FROM products;
  • SELECT product_id, (expiry_date - delivery_date) AS days_difference FROM products; (correct)

Which query can be used to display the product name and unit price with a 10% discount included?

<p>SELECT product_name, unit_price * 0.9 AS discounted_price FROM products; (D)</p> Signup and view all the answers

Which query can be used to display the total cost of all promotions in each category?

<p>SELECT promo_category, SUM(promo_cost) AS total_cost FROM promotions GROUP BY promo_category; (D)</p> Signup and view all the answers

More Like This

Ethical Mindset Quiz
0 questions

Ethical Mindset Quiz

EthicalHeliotrope7625 avatar
EthicalHeliotrope7625
Relational Databases and SQL Quiz
10 questions
SQL Databases Fundamentals Quiz
11 questions
Use Quizgecko on...
Browser
Browser