This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title></title> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="public/style.css"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>WS playground</title> | |
<link rel="stylesheet" href="/style.css"> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="public/style.css"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>WS playground</title> | |
<link rel="stylesheet" href="/style.css"> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="icon" type="image/svg+xml" href="/webstorm-icon-logo.svg" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>WS playground</title> | |
<link rel="stylesheet" href="/style.css"> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Показать самый популярный товар магазина (больше всего раз продавался) | |
SELECT | |
p.name AS product_name, | |
SUM(s.quantity) AS total_sales | |
FROM Product p | |
JOIN Sale s ON p.id = s.id_product | |
GROUP BY p.name | |
HAVING SUM(s.quantity) = ( | |
SELECT MAX(total_sales) | |
FROM ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Показать названия и категории товаров, поставщиками которых являются ООО "Паньки" или ООО «Какие люди» | |
SELECT p.name AS product_name, | |
c.name AS category_name, | |
s.name AS supplier_name | |
FROM Product p | |
JOIN Category c ON p.id_category = c.id | |
JOIN Delivery d ON d.id_product = p.id | |
JOIN Supplier s ON s.id = d.id_supplier | |
WHERE s.name LIKE '%Продукты от А до Я%' OR s.name LIKE '%Все привезем%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE StoreNew | |
-- 1. Написать хранимую процедуру, которая показывает общее количество проданных товаров в каждой из категорий и от каждого производителя. | |
CREATE PROCEDURE SaledProd AS | |
SELECT | |
p.name AS product_name, | |
c.name AS category_name, | |
SUM(s.quantity) AS total_sales, | |
pr.name AS producer_name | |
FROM Product p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Показать среднее арифметическое трех вещественных чисел, хранящихся в пременных | |
DECLARE @a float = 12.5 | |
DECLARE @b float = 7.8 | |
DECLARE @c float = 15.3 | |
DECLARE @avg float = (@a+ @b+ @c)/3 | |
PRINT @avg | |
-- 2. Показать количество цифр числа, хранящегося в переменной | |
DECLARE @number int = 67983456 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [master] | |
GO | |
/****** Object: Database [StoreNew] Script Date: 02.03.2025 10:42:21 ******/ | |
CREATE DATABASE [StoreNew] | |
CONTAINMENT = NONE | |
ON PRIMARY | |
( NAME = N'StoreNew', FILENAME = N'C:\sql\StoreNew.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ) | |
LOG ON | |
( NAME = N'StoreNew_log', FILENAME = N'C:\sql\StoreNew_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB ) | |
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Показать товары, средняя цена продажи которых была больше 50 гривен | |
--SELECT p.name | |
--FROM Product p | |
--JOIN Sale s ON s.product_id = p.product_id | |
--GROUP BY p.name | |
--HAVING AVG(s.price) > 50 | |
-- 2. Вывести количество товаров каждой категории, средняя цена поставки которых больше 100 гривен | |
--SELECT c.name AS category_name, COUNT(p.product_id) AS product_count | |
--FROM Category c |
NewerOlder