Skip to content

Instantly share code, notes, and snippets.

USE [master]
GO
/****** Object: Database [Inventory] Script Date: 8/15/2024 1:33:37 PM ******/
CREATE DATABASE [Inventory]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Inventory', FILENAME = N'D:\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\Inventory.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'Inventory_log', FILENAME = N'D:\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\Inventory_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
-- Task 1
SELECT name, price, discount, quantity , quantity * (price * (1- discount)) AS total
FROM Product
WHERE name LIKE '%bread%' OR name LIKE 'milk'
-- Task 2
SELECT name, quantity
FROM Product
WHERE date_of_delivery BETWEEN DATEADD(day, -2, GETDATE()) AND GETDATE() AND quantity > 100
<!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="">
@smart-onion
smart-onion / j.js
Last active May 12, 2025 10:47
JS2
// Task 1
const comparer = function (a, b){
if(a > b) return 1;
else if(a < b) return -1;
else return 0;
}
console.log(comparer(1, 2));
// Task 2 factorial
let rectangle = {
topLeft: {x:0, y:0},
bottomRight: {x:0, y:0}
}
function width(rect){
return rect.bottomRight.x - rect.topLeft.x;
}
function height(rect){
return rect.topLeft.y - rect.bottom.y;
// Task PrintMachine
class PrintMachine{
constructor(fontSize, fontColor, fontFamily, element = document.body) {
this.fontSize = fontSize;
this.fontColor = fontColor;
this.fontFamily = fontFamily;
this.element = element;
}
class HtmlElement {
#tagOpen;
#tagClose;
constructor(name, paired = true) {
this.name = name;
this.paired = paired;
this.textContent = "";
this.children = [];
this.attributes = [];
// Task 1
function insertTable(){
let table = document.createElement("table");
table.style.border = "1px solid black";
table.style.borderCollapse = "collapse";
for(let i = 0; i < 10; i++) {
let tr = document.createElement("tr");
tr.style.border = "1px solid black";
// Task 1
function randomNumber(){
let div = document.createElement('div');
let text = document.createElement('p');
let h1 = document.createElement('h1');
let btn = document.createElement('button');
text.textContent = "Random number";
h1.textContent = "Number";
<!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="">