Created
October 20, 2023 01:24
-
-
Save FromMeloriWithLove/dd62df801f0bf1fa440bfe57ee035ca5 to your computer and use it in GitHub Desktop.
This file contains 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 [Library]; | |
DECLARE @table TABLE ( | |
id INT, | |
first_name VARCHAR(50), | |
last_name VARCHAR(50), | |
role VARCHAR(20), | |
department VARCHAR(20), | |
birthday DATE | |
); | |
DECLARE cur CURSOR FOR | |
SELECT | |
Teacher.first_name,Teacher.last_name,Department.name | |
FROM | |
Department | |
INNER JOIN Teacher ON Department.id = Teacher.id_department | |
OPEN cur; | |
DECLARE @first_name nvarchar(50) | |
DECLARE @last_name nvarchar(50) | |
DECLARE @department nvarchar(50) | |
DECLARE @birthday DATE | |
FETCH NEXT FROM cur INTO @first_name, @last_name, @department | |
WHILE @@FETCH_STATUS = 0 | |
BEGIN | |
SET @birthday = DATEADD(day, ABS(CHECKSUM(NEWID())) % 1095, '1990-01-01') | |
PRINT 'имя: ' + @first_name + ' ' + @last_name + ', кафедра: ' + @department + ', дата рождения: ' + CAST(@birthday AS varchar(100)) | |
IF @department = 'Компьютерной графики и дизайна' | |
BEGIN | |
PRINT 'Отправить приглашение на защиту курсовых работ которые состоятся 10 октября в 12 ноль ноль' | |
END | |
PRINT ' ' | |
FETCH NEXT FROM cur INTO @first_name, @last_name, @department | |
END; | |
CLOSE cur; | |
DEALLOCATE cur; | |
DECLARE cur CURSOR FOR | |
SELECT | |
Student.first_name,Student.last_name,Department.name | |
FROM | |
Department | |
INNER JOIN dbo.[Group] ON Department.id = dbo.[Group].id_department | |
INNER JOIN Student ON Student.id_group = dbo.[Group].id | |
WHERE | |
dbo.[Group].id_department = 2 | |
OPEN cur; | |
FETCH NEXT FROM cur INTO @first_name, @last_name, @department | |
WHILE @@FETCH_STATUS = 0 | |
BEGIN | |
SET @birthday = DATEADD(day, ABS(CHECKSUM(NEWID())) % 1095, '2002-01-01') | |
PRINT 'имя: ' + @first_name + ' ' + @last_name + ', кафедра: ' + @department + ', дата рождения: ' + CAST(@birthday AS varchar(100)) | |
IF @department = 'Компьютерной графики и дизайна' | |
BEGIN | |
PRINT 'Отправить приглашение на защиту курсовых работ которые состоятся 10 октября в 12 ноль ноль' | |
IF @birthday = '2002-10-6' OR @birthday = '2003-10-6' OR @birthday = '2004-10-6' | |
BEGIN | |
PRINT 'Поздравляю! Вы получили 12 атоматом по курсовому!!!' | |
END | |
END | |
PRINT ' ' | |
FETCH NEXT FROM cur INTO @first_name, @last_name, @department | |
END; | |
CLOSE cur; | |
DEALLOCATE cur; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment