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"> | |
<title>Title</title> | |
</head> | |
<body> | |
<h1>Демонстрация работы с массивами</h1> | |
<p id="output"></p> | |
<p id="output2"></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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<p>Написать функцию, которая принимает 2 числа и возвращает меньшее из них.</p> | |
<p>Написать функцию, которая принимает от 1 до 5 чисел и возвращает большее из них.</p> | |
<p>Написать функцию, которая возводит переданное число в указанную степень.</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
<!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"> | |
<link rel="icon" href="/favicon.ico" sizes="any"> | |
<link rel="icon" href="/icon.svg" type="image/svg+xml"> |
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
============================================================================================================================== | |
SERVER | |
============================================================================================================================== | |
#include <winsock2.h> | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <ctime> | |
#include <windows.h> |
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
CREATE OR ALTER PROCEDURE GetTableFields @TableName NVARCHAR(128) | |
AS | |
BEGIN | |
DECLARE @SQL NVARCHAR(MAX) | |
SET @SQL = ' | |
SELECT | |
c.TABLE_CATALOG AS DatabaseName, | |
c.TABLE_SCHEMA AS SchemaName, | |
c.TABLE_NAME AS TableName, |
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 задания): | |
1. Написать хранимую процедуру, которая показывает общее количество проданных товаров в каждой из категорий и от каждого производителя. | |
--1. Написать хранимую процедуру, которая показывает общее количество проданных товаров в каждой из категорий и от каждого производителя. | |
CREATE PROCEDURE Products_Saled AS | |
SELECT c.name AS [Категория], prr.name AS [Производитель], COUNT(1) AS [Количество проданных товаров] | |
FROM Product p | |
JOIN Category c ON p.id_category = c.id | |
JOIN Sale s ON s.id_product = p.id | |
JOIN Producer prr ON p.id_producer = prr.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. Показать среднее арифметическое трёх вещественных чисел, хранящихся в переменных | |
DECLARE @one float = 85.15 | |
DECLARE @two float = 45.45 | |
DECLARE @three float = 25.25 | |
DECLARE @average float = (@one+@two+@three)/3 | |
PRINT @average | |
--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. Показать самый популярный товар магазина (больше всего раз продавался) | |
SELECT TOP 1 name AS "название товара", (SELECT SUM (quantity) FROM Sale sl WHERE sl.id_product = p.id) AS total_sold | |
FROM Product p | |
ORDER BY total_sold DESC; | |
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
1. Показать товары, средняя цена продажи которых была больше 50 гривен | |
SELECT p.name | |
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. Показать названия и категории товаров, поставщиками которых являются ООО "Паньки" или ООО «Какие люди» | |
SELECT p.name AS "названия товаров", c.name AS "категории товаров", s.name AS "поставщики" | |
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 '%картофка%' |
NewerOlder