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 [DataBase_1] Script Date: 09.03.2025 23:26:37 ******/ | |
CREATE DATABASE [DataBase_1] | |
CONTAINMENT = NONE | |
ON PRIMARY | |
( NAME = N'DataBase_1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\DataBase_1.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ) | |
LOG ON | |
( NAME = N'DataBase_1_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\DataBase_1_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. Порахувати можливий дохід за хліб та молоко (з урахуванням знижок на ці товари) | |
SELECT | |
name AS 'Назва товару', | |
category AS 'Група товарів', | |
price * quantity * (1 - discount * 0.01) AS 'Плановий дохід' | |
FROM [ATB].[dbo].[Product] | |
WHERE category = 'Хлібобулочні вироби' OR category = 'Молочні продукти' | |
ORDER BY name | |
--2. Отримати інформацію про товари, які були доставлені вчора і сьогодні більше 10 одиниць (getdate, dateadd) |
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 [DataBase_1] Script Date: 21.03.2025 0:21:31 ******/ | |
CREATE DATABASE [DataBase_1] | |
CONTAINMENT = NONE | |
ON PRIMARY | |
( NAME = N'DataBase_1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\DataBase_1.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ) | |
LOG ON | |
( NAME = N'DataBase_1_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\DataBase_1_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
#include <iomanip> | |
#include <windows.h> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
#include <iostream> | |
int main() | |
{ |
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
#include <iostream> | |
#include <iomanip> | |
#include <windows.h> | |
#include <cstdlib> | |
#include <ctime> | |
#include <algorithm> | |
using namespace std; | |
int main() |
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
//Проект "Лабіринт" | |
//Завдання: | |
//Якщо персонаж дійшов до виходу з лабіринту в нижньому правому куті, | |
//гра завершується перемогою | |
//(вивести діалог із повідомленням : "Перемога – знайдено вихід"). | |
// | |
//Якщо всі монетки лабіринту зібрані, гра завершується перемогою | |
//(вивести діалог із повідомленням : "Перемога – монети зібрано"). | |
// | |
//Додати новий тип об'єктів лабіринту – "ліки", які при збиранні відновлюють здоров'я на 25 очок. |
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
#include <iostream> | |
#include <iomanip> | |
#include <windows.h> | |
#include <cstdlib> | |
#include <ctime> | |
#include <algorithm> | |
using namespace std; | |
//1. Написати функцію Line, яку можна буде викликати так : Line(20, '@', 12, true); | |
//І при цьому горизонтально буде намальована лінія, що складається з 20 «собачок» червоного кольору. |
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 pr.name ТОВАР, | |
cat.name КАТЕГОРІЯ, | |
sup.name ПОСТАЧАЛЬНИК | |
FROM Delivery d | |
JOIN Supplier sup ON d.id_supplier = sup.id | |
FULL OUTER JOIN Product pr ON d.id_product = pr.id |
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 pr.name ТОВАР, | |
prod.name ВИРОБНИК | |
FROM Product pr | |
RIGHT JOIN Producer prod ON pr.id_producer = prod.id | |
--2.Показати лише ті категорії, до яких не належить жоден товар. |
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.Вивести кількість товарів кожної категорії, | |
-- середня ціна поставки яких більше 100 гривень. | |
SELECT cat.name КАТЕГОРІЯ, | |
COUNT(pr.id) КІЛЬКІСТЬ | |
FROM Delivery d | |
JOIN Product pr ON d.id_product = pr.id | |
JOIN Category cat ON pr.id_category = cat.id | |
GROUP BY cat.name |
OlderNewer