Computer Science

IT Exam Course | Databases #6


categories: computer science

Hello everyone,
Below you will find a video with a detailed explanation of the statements and keywords related to: mathematical functions and subqueries. 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 ROUND(Srednia^2, 3) AS KwadratSredniej,
       ROUND(SQR(Srednia), 3) AS PierwiastekSredniej,
       ROUND(ABS(SQR(Srednia) - Srednia^2) MOD Srednia, 3) AS ModuloKwadratPierwiastek
FROM srednia
WHERE ABS(DATEDIFF('d', DataP, DataK)) < 30;
              

Statements: SELECT, ROUND, AS, SQR, ABS, MOD, FROM, WHERE, DATEDIFF


Query 2:



SELECT Imie, Nazwisko
FROM uczniowie
WHERE IdUcznia =
(SELECT TOP 1 Id
FROM srednia
ORDER BY Srednia DESC);
              

Statements: SELECT, FROM, WHERE, TOP, ORDER BY, DESC


Query 3:



SELECT TOP 1 Imie, Nazwisko
FROM uczniowie
INNER JOIN srednia ON srednia.Id = uczniowie.IdUcznia
ORDER BY Srednia DESC;
              

Statements: SELECT, TOP, FROM, INNER JOIN, ON, ORDER BY, DESC


Query 4:



SELECT Imie, Nazwisko
FROM uczniowie
WHERE IdUcznia IN
(SELECT Id
FROM srednia
WHERE Srednia > 4.0);
              

Statements: SELECT, FROM, WHERE, IN


Query 5:



SELECT Imie, Nazwisko
FROM uczniowie
WHERE IdUcznia NOT IN
(SELECT Id
FROM srednia
WHERE Srednia > 4.0);
              

Statements: SELECT, FROM, WHERE, NOT IN


Query 6:



SELECT MAX(LEN(Nazwisko)) AS DlugoscNajdNazwiZ1A
FROM (SELECT Nazwisko
FROM uczniowie
WHERE klasa = '1A');
              

Statements: SELECT, MAX, LEN, AS, FROM


Video:

Thank you for reading!


Read more
Administrator

This post was written by the administrator

Recent Posts

Proof Problems in Mathematics The Beginning Integrals, Course Practical Physics for Engineers IT Matura Course | Algorithms IT Matura Course | Databases IT Matura Course | Theory IT Matura Course | Spreadsheet

Archive

Year 2022

Comments