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> | |
<link rel="stylesheet" href="css/style.css"> | |
<meta name="description" content=""> | |
</head> |
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
--USER DEFINED FUNCTIONS (любые три из 4): | |
--1. Написать функцию, которая покажет список всех пользовательских баз данных SQL Server, и их общие размеры в байтах | |
CREATE FUNCTION TotalBDSize() | |
RETURNS TABLE | |
AS RETURN ( | |
SELECT | |
name AS "базы данных", | |
SUM(size * 8) AS "размер в байтах" | |
FROM sys.master_files | |
GROUP BY name) |
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
--STORED PROCEDURES (выполнить минимум 3 задания): | |
--3. Написать хранимую процедуру, которая показывает список производителей и общее количество товаров, произведённых каждым из них. | |
--CREATE PROCEDURE ProducersAndProducts | |
--AS | |
--BEGIN | |
-- SELECT | |
-- pr.name AS производитель, | |
-- COUNT(p.id) AS "общее количество товаров" | |
-- FROM Producer pr | |
-- JOIN Product p ON p.id_producer = 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
--VARIABLES: | |
--1. Показать среднее арифметическое трёх вещественных чисел, хранящихся в переменных | |
--DECLARE @number1 float = 50 | |
--DECLARE @number2 float = 30 | |
--DECLARE @number3 float = 20 | |
--DECLARE @avg float | |
--SET @avg = (@number1 + @number2 + @number3) / 3 | |
--PRINT @avg | |
--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
--SUBQUERIES (в решении обязательно использовать минимум один подзапрос!): | |
--1. Показать самый популярный товар магазина (больше всего раз продавался) | |
--SELECT TOP 1 | |
-- p.name AS товар, | |
-- (SELECT SUM(s.quantity) | |
-- FROM Sale s | |
-- WHERE s.id_product = p.id) AS количество | |
--FROM Product p | |
--ORDER BY количество DESC |
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 AS Товары, | |
--SUM(s.price) AS Цена | |
--FROM Product p | |
--JOIN Sale s ON s.id_product = p.id | |
--GROUP BY p.name | |
--HAVING AVG(s.price) > 50 | |
--2. Вывести количество товаров каждой категории, средняя цена поставки которых больше 100 гривен |
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
--INNER JOINS | |
--1. Показать названия и категории товаров, поставщиками которых являются 000 “Паньки” или 000 «Какие люди» | |
--SELECT | |
--p.name AS Товар, | |
--c.name AS Категория, | |
--sr.name AS Поставщик | |
--FROM Product p | |
--JOIN Category c ON p.id_category = c.id | |
--JOIN Supplier sr ON p.id_supplier = sr.id | |
--WHERE sr.name IN ('Dairy World', 'Global Bakery') |
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 *, ROUND(price * quantity - price - discount, 2) [общая сумма] -- работает даже без AS | |
-- FROM Product | |
-- WHERE name LIKE '%Хлеб%' OR name LIKE '%Молоко%' | |
-- 2. Получить информацию о том, каких товаров вчера и сегодня доставили более 10 штук (getdate, dateadd) | |
-- SELECT * | |
-- FROM Product | |
-- WHERE date_of_delivery = CAST(GETDATE() AS DATE) OR date_of_delivery = CAST(DATEADD(DAY, -1, GETDATE()) AS DATE) | |
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 [Store] Script Date: 14.02.2025 00:27:13 ******/ | |
CREATE DATABASE [Store] | |
CONTAINMENT = NONE | |
ON PRIMARY | |
( NAME = N'Store', FILENAME = N'C:\MyStore\Store.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ) | |
LOG ON | |
( NAME = N'Store_log', FILENAME = N'C:\MyStore\Store_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 <iostream> | |
#include <windows.h> | |
#include <conio.h> | |
using namespace std; | |
enum KeyCodes { ENTER = 13, ESCAPE = 27, LEFT = 75, RIGHT = 77, UP = 72, DOWN = 80, SPACEBAR = 32 }; | |
enum Colors { DARKGREEN = 2, RED = 12, YELLOW = 14, BLUE = 9, PINK = 4, WHITE = 5, MAGENTA = 13 }; | |
enum Objects { HALL, WALL, COIN, ENEMY, BOMB, BONUS_ENERGY, BONUS_HP, SECOND_ENEMY, THIRD_ENEMY }; | |
void generation_location(int HEIGHT, int WIDTH, int location[][50]); |
NewerOlder