Skip to content

Instantly share code, notes, and snippets.

@OlegPetrenkoGit
OlegPetrenkoGit / Queries.sql
Last active April 5, 2024 04:51
Sql interview
-- 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);
@OlegPetrenkoGit
OlegPetrenkoGit / Binary file converter methods.cs
Created July 12, 2016 11:16
Read/Write fromto Binary file
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)