Blog, SQLSQL QUIZ TIME26/07/2024 / 0 YorumSQL (Structured Query Language), veritabanı yönetim sistemlerinde veri sorgulama, güncelleme ve yönetme için kullanılan bir dildir. Kategori: SQL Değerlendirme/5 0 oylar, 0 ort 28 SQL Orta Seviye Quiz 1SQL quiz helps us to increase our knowledge İsimEposta 1 / 5employees tablosunda her departmandaki çalışanların ortalama maaşını hesaplamak için hangi SQL sorgusu kullanılır? SELECT department_id, AVG(salary) FROM employees; SELECT department_id, AVG(salary) FROM employees GROUP BY department_id; SELECT department_id, salary FROM employees GROUP BY department_id; SELECT department_id, AVG(salary) FROM employees GROUP BY salary; 2 / 5Bir orders tablosunda order_date sütunu 2023 yılına ait olan kayıtları seçmek için hangi sorgu kullanılır? SELECT * FROM orders WHERE YEAR(order_date) = 2023; SELECT * FROM orders WHERE order_date = '2023'; SELECT * FROM orders WHERE order_date LIKE '%2023%'; SELECT * FROM orders WHERE DATE(order_date) = 2023; 3 / 5products tablosunda price sütunu 100'den büyük olan ürünleri listelemek için hangi SQL sorgusu kullanılır? SELECT * FROM products WHERE price > 100; SELECT * FROM products WHERE price >= 100; SELECT * FROM products WHERE price < 100; SELECT * FROM products WHERE price = 100; 4 / 5Products tablosunda stokta olan ürünlerin toplam sayısını bulmak için hangi SQL sorgusu kullanılır? SELECT SUM(quantity) FROM products; SELECT COUNT(quantity) FROM products; SELECT TOTAL(quantity) FROM products; SELECT COUNT(*) FROM products WHERE quantity > 0; 5 / 5Bir veritabanında, employees tablosunda tüm çalışanların maaşlarını 10% artırmak için hangi SQL sorgusu kullanılır? UPDATE employees SET salary = salary * 1.1; ALTER employees SET salary = salary + 10; MODIFY employees SET salary = salary + salary * 0.1; INSERT INTO employees (salary) VALUES (salary * 1.1); PuanınızOrtalama puan şöyledir 26% LinkedIn Facebook VKontakte 0% Testi yeniden başlat /5 SQL Değerlendirme SQL Orta Seviye 1 / 5Bir orders tablosunda order_date sütunu 2023 yılına ait olan kayıtları seçmek için hangi sorgu kullanılır? SELECT * FROM orders WHERE YEAR(order_date) = 2023; SELECT * FROM orders WHERE order_date = '2023'; SELECT * FROM orders WHERE order_date LIKE '%2023%'; SELECT * FROM orders WHERE DATE(order_date) = 2023; 2 / 5Bir products tablosunda price sütunu 100 ile 500 arasında olan ürünleri seçmek için hangi sorgu kullanılır? SELECT * FROM products WHERE price BETWEEN 100 AND 500; SELECT * FROM products WHERE price >= 100 AND price <= 500; SELECT * FROM products WHERE price > 100 AND price < 500; SELECT * FROM products WHERE price IN (100, 500); 3 / 5Bir orders tablosunda en yüksek toplam satışa sahip müşteriyi seçmek için hangi sorgu kullanılır? SELECT customer_id, SUM(order_total) as total_sales FROM orders GROUP BY customer_id ORDER BY total_sales DESC LIMIT 1; SELECT customer_id, MAX(order_total) as total_sales FROM orders GROUP BY customer_id ORDER BY total_sales DESC LIMIT 1; SELECT customer_id, COUNT(order_total) as total_sales FROM orders GROUP BY customer_id ORDER BY total_sales DESC LIMIT 1; SELECT customer_id, AVG(order_total) as total_sales FROM orders GROUP BY customer_id ORDER BY total_sales DESC LIMIT 1; 4 / 5Bir employees tablosunda her bölümdeki çalışan sayısını 10'dan fazla olan bölümleri seçmek için hangi sorgu kullanılır? SELECT department_id, COUNT(*) FROM employees GROUP BY department_id HAVING COUNT(*) > 10; SELECT department_id, COUNT(*) FROM employees WHERE COUNT(*) > 10 GROUP BY department_id; SELECT department_id FROM employees GROUP BY department_id WHERE COUNT(*) > 10; SELECT department_id, COUNT(*) FROM employees HAVING COUNT(*) > 10; 5 / 5Bir sales tablosunda her departmandaki toplam satış miktarını hesaplamak için hangi sorgu kullanılır? SELECT department_id, SUM(sales_amount) as total_sales FROM sales GROUP BY department_id; SELECT department_id, COUNT(sales_amount) as total_sales FROM sales GROUP BY department_id; SELECT department_id, AVG(sales_amount) as total_sales FROM sales GROUP BY department_id; SELECT department_id, MAX(sales_amount) as total_sales FROM sales GROUP BY department_id; PuanınızOrtalama puan şöyledir 23% LinkedIn Facebook VKontakte 0% Testi yeniden başlat English SQL QUIZ 1 / 4Which SQL statement is used to insert new data in a database? ADD RECORD INSERT INTO ADD NEW 2 / 4ExceptPreviously we learned the concept of INTERSECT, now lets see how EXCEPT works.EXCEPT is directly opposite to that of INTERSECT.EXCEPT retrieves unique records from the first SELECT statement that are not present in the output of the second SELECT statement.Below is the format for the same: SELECT * FROM table_1 EXCEPT SELECT * FROM table_2;TaskConsider the same supermarket database we used in the previous problem.Write a query to output the name of the fruits (f_name) from the table 'fruit' which are not present in the table inventory.f_name column has the name of the fruits and inv_name has the name of the items in inventory.Expected output┌────────┐│ f_name │├────────┤│ Apple ││ Mango ││ Orange │└────────┘ Onayla 3 / 4The INTERSECT operator combines two SELECT statements, but only returns the rows that are common to both SELECT statements.Below is the format for the same: SELECT * FROM table_1 INTERSECT SELECT * FROM table_2;TaskConsider a supermarket databaseTable 'fruit' has the list of all fruits available in the market(few of them could be out of stock).Table 'inventory' has the updated list of items in the supermarket.Write a query to find the list of fruits available in the supermarket. (f_name column has the name of the fruits and inv_name has the name of the items in the inventory, you are suppose to output the name of the fruits.)Expected output┌────────────┐│ f_name │├────────────┤│ Banana ││ Cherry ││ Grape ││ Kiwi ││ Pear ││ Pineapple ││ Watermelon │└────────────┘ Onayla 4 / 4What is the difference between UNION and UNION ALL in SQL? UNION combines and eliminates duplicates from the result sets, while UNION ALL combines all rows without eliminating duplicates. UNION ALL combines and eliminates duplicates from the result sets, while UNION combines all rows without eliminating duplicates. UNION and UNION ALL are identical and can be used interchangeably. UNION and UNION ALL have different syntax, but produce the same output. PuanınızOrtalama puan şöyledir 19% 0% Testi yeniden başlat