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
public static void WriteToBinaryFile < T > (string filePath, T objectToWrite, bool append = false) | |
{ | |
using(Stream stream = File.Open(filePath, append ? FileMode.Append : FileMode.Create)) | |
{ | |
var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); | |
binaryFormatter.Serialize(stream, objectToWrite); | |
} | |
} | |
public static T ReadFromBinaryFile < T > (string filePath) |
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
-- 1. Вывести список сотрудников, получающих заработную плату большую чем у непосредственного руководителя | |
SELECT * | |
FROM Employee AS employees, Employee AS chieves | |
WHERE chieves.id = employees.chief_id AND employees.salary > chieves.salary; | |
-- 2. Вывести список сотрудников, получающих максимальную заработную плату в своем отделе | |
SELECT * | |
FROM Employee AS employees | |
WHERE employees.salary = (SELECT MAX(salary) FROM Employee AS max WHERE max.department_id = employees.department_id); |