categories: computer science
Hello everyone,
Below you will find a video with a detailed explanation of the statements and keywords:
SELECT, TOP, FROM, WHERE, ORDER BY, DESC, as well as creating and modifying tables.
It covers how they work, their time complexity, and their usefulness. Below you will also find ready-to-copy code in case you need it.
Query 1:
SELECT TOP 1 klasa, imie
FROM klasy
WHERE klasa < 7
ORDER BY klasa DESC;
Statements: SELECT, TOP, FROM, WHERE, ORDER BY, DESC
Query 2:
CREATE TABLE uczniowie (
Imie VARCHAR(20) NOT NULL,
Nazwisko VARCHAR(40),
Klasa VARCHAR(3) NOT NULL,
Srednia DOUBLE NOT NULL,
Data DATE NOT NULL
);
Creating a table
Query 3:
DELETE *
FROM klasy
WHERE imie LIKE 'S*';
Deleting records from a table
Query 4:
DROP TABLE niepotrzebna;
Deleting a table
Query 5:
INSERT INTO klasy
VALUES ('Piotr', 12);
Inserting values into a table
Query 6:
INSERT INTO kopiaKlasy (imie, klasa)
SELECT imie, klasa
FROM klasy;
Copying the contents of one table into another
Query 7:
UPDATE klasy
SET imie = 'Marcin'
WHERE klasa = 1 AND imie = 'Szymon';
Changing the contents of a table
Video:
Thank you for reading!
Read more