0% found this document useful (0 votes)
81 views21 pages

Bilete Atestat SQL

This document contains SQL queries and results from interacting with a MariaDB database. It creates databases and tables, inserts sample data, and performs queries and updates. Specifically, it creates databases and tables to store dossier records, train tickets, and currency exchange rates, inserts test data, and runs SELECT, UPDATE and other SQL statements to retrieve, modify and view the stored data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views21 pages

Bilete Atestat SQL

This document contains SQL queries and results from interacting with a MariaDB database. It creates databases and tables, inserts sample data, and performs queries and updates. Specifically, it creates databases and tables to store dossier records, train tickets, and currency exchange rates, inserts test data, and runs SELECT, UPDATE and other SQL statements to retrieve, modify and view the stored data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Biletul 40

Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.4.13-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE dosar;


Query OK, 1 row affected (0.028 sec)

MariaDB [(none)]> use dosar;


Database changed
MariaDB [dosar]> create table dosare (Nr_dosar text(20), Obiect text(80), Nr_pagini
int, Finalizat char(1), Data date);
Query OK, 0 rows affected (0.067 sec)

MariaDB [dosar]> insert into dosare values ("4587/117/2011", "Contestatie decizie


de pensionare", 23, "Y", "2014-04-22");
Query OK, 1 row affected (0.302 sec)

MariaDB [dosar]> insert into dosare values ("4525/211/2014", "Pretentii", 64, "N",
"2014-10-08");
Query OK, 1 row affected (0.001 sec)

MariaDB [dosar]> insert into dosare values ("22898/211/2013", "Contestatie la


executare", 43, "N", "2014-05-28");
Query OK, 1 row affected (0.001 sec)

MariaDB [dosar]> insert into dosare values ("4123/235/2011", "Succesiune", 112,


"Y", "2014-06-04");
Query OK, 1 row affected (0.001 sec)

MariaDB [dosar]> insert into dosare values ("706/242/2012", "Uzucapiune", 51, "N",
"2014-05-04");
Query OK, 1 row affected (0.001 sec)

MariaDB [dosar]> insert into dosare values ("4575/117/2012", "Anulare acte emise de
autoritati", 14, "N", "2014-06-12");
Query OK, 1 row affected (0.001 sec)

MariaDB [dosar]> select * from dosare where finalizat = "Y";


+---------------+-----------------------------------+-----------+-----------
+------------+
| Nr_dosar | Obiect | Nr_pagini | Finalizat | Data
|
+---------------+-----------------------------------+-----------+-----------
+------------+
| 4587/117/2011 | Contestatie decizie de pensionare | 23 | Y | 2014-
04-22 |
| 4123/235/2011 | Succesiune | 112 | Y | 2014-
06-04 |
+---------------+-----------------------------------+-----------+-----------
+------------+
2 rows in set (0.021 sec)

MariaDB [dosar]> update dosare set nr_pagini = 116, data = "2014-09-09" where
nr_dosar ="4123/235/2011";
Query OK, 1 row affected (0.005 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [dosar]> select * from dosare;


+----------------+-----------------------------------+-----------+-----------
+------------+
| Nr_dosar | Obiect | Nr_pagini | Finalizat | Data
|
+----------------+-----------------------------------+-----------+-----------
+------------+
| 4587/117/2011 | Contestatie decizie de pensionare | 23 | Y |
2014-04-22 |
| 4525/211/2014 | Pretentii | 64 | N |
2014-10-08 |
| 22898/211/2013 | Contestatie la executare | 43 | N |
2014-05-28 |
| 4123/235/2011 | Succesiune | 116 | Y |
2014-09-09 |
| 706/242/2012 | Uzucapiune | 51 | N |
2014-05-04 |
| 4575/117/2012 | Anulare acte emise de autoritati | 14 | N |
2014-06-12 |
+----------------+-----------------------------------+-----------+-----------
+------------+
6 rows in set (0.028 sec)

MariaDB [dosar]>

Biletul 39
MariaDB [dosar]> CREATE DATABASE bilet39;
Query OK, 1 row affected (0.008 sec)

MariaDB [dosar]> use bilet39;


Database changed
MariaDB [bilet39]> create table bilete (Serie int(6), Plecare text(80), Sosire
text(80), Pret float(5,2), Data date);
Query OK, 0 rows affected (0.065 sec)

MariaDB [bilet39]> insert into bilete values (453322 , "Craiova", "Targu-Jiu",


20.70,"2015-05-23");
Query OK, 1 row affected (0.010 sec)

MariaDB [bilet39]> insert into bilete values ( 453024, "Sibiu", "Brasov",


26.00,"2015-05-19");
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet39]> insert into bilete values ( 453207, "Sibiu", "Timisoara",


58.30,"2015-05-21");
Query OK, 1 row affected (0.003 sec)

MariaDB [bilet39]> insert into bilete values ( 453691, "Bucuresti", "Pitesti",


22.00,"2015-05-19");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet39]> insert into bilete values ( 453672, "Bucuresti", "Timisoara",


79.00,"2015-05-20");
Query OK, 1 row affected (0.021 sec)
MariaDB [bilet39]> insert into bilete values ( 453428, "Craiova", "Ploiesti",
41.75,"2015-05-21");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet39]> select * from bilete where plecare = "Craiova";


+--------+---------+-----------+-------+------------+
| Serie | Plecare | Sosire | Pret | Data |
+--------+---------+-----------+-------+------------+
| 453322 | Craiova | Targu-Jiu | 20.70 | 2015-05-23 |
| 453428 | Craiova | Ploiesti | 41.75 | 2015-05-21 |
+--------+---------+-----------+-------+------------+
2 rows in set (0.002 sec)

MariaDB [bilet39]> update bilete set pret = pret - pret * 5 /100 where data =
"2015-05-21";
Query OK, 2 rows affected (0.005 sec)
Rows matched: 2 Changed: 2 Warnings: 0

MariaDB [bilet39]> select * from bilete;


+--------+-----------+-----------+-------+------------+
| Serie | Plecare | Sosire | Pret | Data |
+--------+-----------+-----------+-------+------------+
| 453322 | Craiova | Targu-Jiu | 20.70 | 2015-05-23 |
| 453024 | Sibiu | Brasov | 26.00 | 2015-05-19 |
| 453207 | Sibiu | Timisoara | 55.38 | 2015-05-21 |
| 453691 | Bucuresti | Pitesti | 22.00 | 2015-05-19 |
| 453672 | Bucuresti | Timisoara | 79.00 | 2015-05-20 |
| 453428 | Craiova | Ploiesti | 39.66 | 2015-05-21 |
+--------+-----------+-----------+-------+------------+
6 rows in set (0.019 sec)

Biletul 38

MariaDB [bilet39]> CREATE DATABASE bilet38;


Query OK, 1 row affected (0.045 sec)

MariaDB [bilet39]> use bilet38;


Database changed
MariaDB [bilet38]> insert into premii values ("Matematica", "Ciobanu Maria", "I",
400, "Y");
ERROR 1146 (42S02): Table 'bilet38.premii' doesn't exist
MariaDB [bilet38]> create table premii (Olimpiada text(50), Elev text(80), Premiu
text(20), Suma_premiere int(5), excursie char(1));
Query OK, 0 rows affected (0.108 sec)

MariaDB [bilet38]> insert into premii values ("Matematica", "Ciobanu Maria", "I",
400, "Y");
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet38]> insert into premii values ("Fizica", "Cojocaru Robert", "III",
200, "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet38]> insert into premii values ("Matematica", "Zaharia Nicoleta",


"M", 80, "N");
Query OK, 1 row affected (0.001 sec)
MariaDB [bilet38]> insert into premii values ("Informatica", "Stefanescu Dan", "M",
80, "Y");
Query OK, 1 row affected (0.010 sec)

MariaDB [bilet38]> insert into premii values ("Chimie", "Rotaru Dragos", "II", 300,
"Y");
Query OK, 1 row affected (0.004 sec)

MariaDB [bilet38]> insert into premii values ("Informatica", "Rusu Raluca", "II",
300, "Y");
Query OK, 1 row affected (0.006 sec)

MariaDB [bilet38]> select * from premii;


+-------------+------------------+--------+---------------+----------+
| Olimpiada | Elev | Premiu | Suma_premiere | excursie |
+-------------+------------------+--------+---------------+----------+
| Matematica | Ciobanu Maria | I | 400 | Y |
| Fizica | Cojocaru Robert | III | 200 | N |
| Matematica | Zaharia Nicoleta | M | 80 | N |
| Informatica | Stefanescu Dan | M | 80 | Y |
| Chimie | Rotaru Dragos | II | 300 | Y |
| Informatica | Rusu Raluca | II | 300 | Y |
+-------------+------------------+--------+---------------+----------+
6 rows in set (0.001 sec)

MariaDB [bilet38]> select elev from premii where excursie = "Y";


+----------------+
| elev |
+----------------+
| Ciobanu Maria |
| Stefanescu Dan |
| Rotaru Dragos |
| Rusu Raluca |
+----------------+
4 rows in set (0.011 sec)

MariaDB [bilet38]> update premii set suma_premiere = 100 where premiu = "M";
Query OK, 2 rows affected (0.042 sec)
Rows matched: 2 Changed: 2 Warnings: 0

MariaDB [bilet38]> select * from premii;


+-------------+------------------+--------+---------------+----------+
| Olimpiada | Elev | Premiu | Suma_premiere | excursie |
+-------------+------------------+--------+---------------+----------+
| Matematica | Ciobanu Maria | I | 400 | Y |
| Fizica | Cojocaru Robert | III | 200 | N |
| Matematica | Zaharia Nicoleta | M | 100 | N |
| Informatica | Stefanescu Dan | M | 100 | Y |
| Chimie | Rotaru Dragos | II | 300 | Y |
| Informatica | Rusu Raluca | II | 300 | Y |
+-------------+------------------+--------+---------------+----------+
6 rows in set (0.001 sec)

Bilet 37
MariaDB [bilet38]> CREATE DATABASE bilet37;
Query OK, 1 row affected (0.067 sec)
MariaDB [bilet38]> use bilet37;
Database changed
MariaDB [bilet37]> create table CursV (Data date, Euro float(5,4), Dolar
float(5,4), Lira_sterlina float(5,4), Leva_bg float(5,4));
Query OK, 0 rows affected (0.055 sec)

MariaDB [bilet37]> insert into cursv values ("2014-03-06", 4.4986, 3.2752, 2.2519,
1.4239);
Query OK, 1 row affected (0.004 sec)

MariaDB [bilet37]> insert into cursv values ("2014-03-05", 4.5123, 3.2896, 2.2600,
1.4259);
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet37]> insert into cursv values ("2014-03-04", 4.5196, 3.2852, 2.2652,
1.4216);
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet37]> insert into cursv values ("2014-03-03", 4.5169, 3.2776, 2.2720,
1.4192);
Query OK, 1 row affected (0.005 sec)

MariaDB [bilet37]> insert into cursv values ("2014-02-28", 4.4995, 3.2618, 2.2501,
1.4178);
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet37]> insert into cursv values ("2014-02-27", 4.5034, 3.2997, 2.2826,
1.4330);
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet37]> select * from cursv;


+------------+--------+--------+---------------+---------+
| Data | Euro | Dolar | Lira_sterlina | Leva_bg |
+------------+--------+--------+---------------+---------+
| 2014-03-06 | 4.4986 | 3.2752 | 2.2519 | 1.4239 |
| 2014-03-05 | 4.5123 | 3.2896 | 2.2600 | 1.4259 |
| 2014-03-04 | 4.5196 | 3.2852 | 2.2652 | 1.4216 |
| 2014-03-03 | 4.5169 | 3.2776 | 2.2720 | 1.4192 |
| 2014-02-28 | 4.4995 | 3.2618 | 2.2501 | 1.4178 |
| 2014-02-27 | 4.5034 | 3.2997 | 2.2826 | 1.4330 |
+------------+--------+--------+---------------+---------+
6 rows in set (0.001 sec)

MariaDB [bilet37]> select * from cursv where month(data) = 3 and year(data) = 2014
order by data;
+------------+--------+--------+---------------+---------+
| Data | Euro | Dolar | Lira_sterlina | Leva_bg |
+------------+--------+--------+---------------+---------+
| 2014-03-03 | 4.5169 | 3.2776 | 2.2720 | 1.4192 |
| 2014-03-04 | 4.5196 | 3.2852 | 2.2652 | 1.4216 |
| 2014-03-05 | 4.5123 | 3.2896 | 2.2600 | 1.4259 |
| 2014-03-06 | 4.4986 | 3.2752 | 2.2519 | 1.4239 |
+------------+--------+--------+---------------+---------+
4 rows in set (0.005 sec)

MariaDB [bilet37]> select max(Euro) from CursV;


+-----------+
| max(Euro) |
+-----------+
| 4.5196 |
+-----------+
1 row in set (0.046 sec)

Biletul 36

MariaDB [bilet37]> create database bilet36;


Query OK, 1 row affected (0.009 sec)

MariaDB [bilet37]> use bilet36;


Database changed
MariaDB [bilet36]> create table fructe (Cod_fruct int(4), Denumire text(80), Pret
float(5,2), Unit_masura text(20), Disponibilitate char(1));
Query OK, 0 rows affected (0.400 sec)

MariaDB [bilet36]> insert into fructe values (345, "Struguri", 5.35, "Kg", "Y");
Query OK, 1 row affected (0.099 sec)

MariaDB [bilet36]> insert into fructe values (7634, "Pepeni", 0.80, "Kg", "Y");
Query OK, 1 row affected (0.004 sec)

MariaDB [bilet36]> insert into fructe values (344, "Banane", 5.30, "Kg", "N");
Query OK, 1 row affected (0.007 sec)

MariaDB [bilet36]> insert into fructe values (5433, "Portocale", 6.70, "Plasa 2Kg",
"Y");
Query OK, 1 row affected (0.033 sec)

MariaDB [bilet36]> insert into fructe values (496, "Mere", 7.90, "Plasa 3Kg", "Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet36]> insert into fructe values (5433, "Prune", 1.85, "Kg", "Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet36]> select * from fructe;


+-----------+-----------+------+-------------+-----------------+
| Cod_fruct | Denumire | Pret | Unit_masura | Disponibilitate |
+-----------+-----------+------+-------------+-----------------+
| 345 | Struguri | 5.35 | Kg | Y |
| 7634 | Pepeni | 0.80 | Kg | Y |
| 344 | Banane | 5.30 | Kg | N |
| 5433 | Portocale | 6.70 | Plasa 2Kg | Y |
| 496 | Mere | 7.90 | Plasa 3Kg | Y |
| 5433 | Prune | 1.85 | Kg | Y |
+-----------+-----------+------+-------------+-----------------+
6 rows in set (0.001 sec)

MariaDB [bilet36]> select * from fructe where disponibilitate = "Y";


+-----------+-----------+------+-------------+-----------------+
| Cod_fruct | Denumire | Pret | Unit_masura | Disponibilitate |
+-----------+-----------+------+-------------+-----------------+
| 345 | Struguri | 5.35 | Kg | Y |
| 7634 | Pepeni | 0.80 | Kg | Y |
| 5433 | Portocale | 6.70 | Plasa 2Kg | Y |
| 496 | Mere | 7.90 | Plasa 3Kg | Y |
| 5433 | Prune | 1.85 | Kg | Y |
+-----------+-----------+------+-------------+-----------------+
5 rows in set (0.001 sec)
MariaDB [bilet36]> update fructe set pret = pret - pret * 8 / 100 where denumire =
"Pepeni";
Query OK, 1 row affected (0.002 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [bilet36]> select * from fructe;


+-----------+-----------+------+-------------+-----------------+
| Cod_fruct | Denumire | Pret | Unit_masura | Disponibilitate |
+-----------+-----------+------+-------------+-----------------+
| 345 | Struguri | 5.35 | Kg | Y |
| 7634 | Pepeni | 0.74 | Kg | Y |
| 344 | Banane | 5.30 | Kg | N |
| 5433 | Portocale | 6.70 | Plasa 2Kg | Y |
| 496 | Mere | 7.90 | Plasa 3Kg | Y |
| 5433 | Prune | 1.85 | Kg | Y |
+-----------+-----------+------+-------------+-----------------+
6 rows in set (0.002 sec)

Biletul 35
MariaDB [bilet36]> create database bilet35;
Query OK, 1 row affected (0.011 sec)

MariaDB [bilet36]> use bilet35;


Database changed
MariaDB [bilet35]> create table filme (Id_film int(4), Titlu text(100), Gen
text(50), Durata int(3), An_aparitie int(4), Versiune_3D char(1));
Query OK, 0 rows affected (0.716 sec)

MariaDB [bilet35]> insert into filme values (2485, "Star Wars - Revenge of the
Sith", "Fictiune", 140, 2005, "Y");
Query OK, 1 row affected (0.013 sec)

MariaDB [bilet35]> insert into filme values (2858, "Slumdog Millionaire", "Drama",
120, 2008, "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet35]> insert into filme values (2109, "A Beautiful Mind", "Drama",
135, 2001, "N");
Query OK, 1 row affected (0.005 sec)

MariaDB [bilet35]> insert into filme values (2011, "The Departed", "Thriller", 151,
2006, "Y");
Query OK, 1 row affected (0.022 sec)

MariaDB [bilet35]> insert into filme values (2885, "Back to the future",
"Fictiune", 116, 1985, "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet35]> insert into filme values (2665, "Gladiator", "Drama", 155, 2000,
"N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet35]> select * from filme;


+---------+---------------------------------+----------+--------+-------------
+-------------+
| Id_film | Titlu | Gen | Durata | An_aparitie |
Versiune_3D |
+---------+---------------------------------+----------+--------+-------------
+-------------+
| 2485 | Star Wars - Revenge of the Sith | Fictiune | 140 | 2005 | Y
|
| 2858 | Slumdog Millionaire | Drama | 120 | 2008 | N
|
| 2109 | A Beautiful Mind | Drama | 135 | 2001 | N
|
| 2011 | The Departed | Thriller | 151 | 2006 | Y
|
| 2885 | Back to the future | Fictiune | 116 | 1985 | N
|
| 2665 | Gladiator | Drama | 155 | 2000 | N
|
+---------+---------------------------------+----------+--------+-------------
+-------------+
6 rows in set (0.041 sec)

MariaDB [bilet35]> select * from filme where gen = "Drama" order by an_aparitie;
+---------+---------------------+-------+--------+-------------+-------------+
| Id_film | Titlu | Gen | Durata | An_aparitie | Versiune_3D |
+---------+---------------------+-------+--------+-------------+-------------+
| 2665 | Gladiator | Drama | 155 | 2000 | N |
| 2109 | A Beautiful Mind | Drama | 135 | 2001 | N |
| 2858 | Slumdog Millionaire | Drama | 120 | 2008 | N |
+---------+---------------------+-------+--------+-------------+-------------+
3 rows in set (0.003 sec)

MariaDB [bilet35]> select gen, avg(durata) as durata_medie from filme group by gen;
+----------+--------------+
| gen | durata_medie |
+----------+--------------+
| Drama | 136.6667 |
| Fictiune | 128.0000 |
| Thriller | 151.0000 |
+----------+--------------+
3 rows in set (0.148 sec)

Bilet 34

MariaDB [bilet35]> create database bilet34;


Query OK, 1 row affected (0.008 sec)

MariaDB [bilet35]> use bilet34;


Database changed
MariaDB [bilet34]> create table melodii (Id_melodie int(4), Titlu text(100),
Artist text(100), Durata int(3), Data_aparitie date);
Query OK, 0 rows affected (0.224 sec)

MariaDB [bilet34]>
MariaDB [bilet34]>
MariaDB [bilet34]>
MariaDB [bilet34]> insert into melodii values (1254, "Desert rose", "Sting", 286,
"1999-09-24");
Query OK, 1 row affected (0.007 sec)

MariaDB [bilet34]> insert into melodii values (1043, "House of rising sun", "Deep
Purple", 230, "1973-01-12");
Query OK, 1 row affected (0.001 sec)
MariaDB [bilet34]> insert into melodii values (1067, "Every breath you take",
"Sting", 253, "1983-06-01");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet34]> insert into melodii values (1198, "Left outside alone",
"Anastacia", 233, "2004-03-15");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet34]> insert into melodii values (1233, "Child in time", "Deep
Purple", 614, "1970-06-03");
Query OK, 1 row affected (0.004 sec)

MariaDB [bilet34]> insert into melodii values (1022, "Nothing else matters",
"Metallica", 389, "1991-08-02");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet34]> select * from melodii;


+------------+-----------------------+-------------+--------+---------------+
| Id_melodie | Titlu | Artist | Durata | Data_aparitie |
+------------+-----------------------+-------------+--------+---------------+
| 1254 | Desert rose | Sting | 286 | 1999-09-24 |
| 1043 | House of rising sun | Deep Purple | 230 | 1973-01-12 |
| 1067 | Every breath you take | Sting | 253 | 1983-06-01 |
| 1198 | Left outside alone | Anastacia | 233 | 2004-03-15 |
| 1233 | Child in time | Deep Purple | 614 | 1970-06-03 |
| 1022 | Nothing else matters | Metallica | 389 | 1991-08-02 |
+------------+-----------------------+-------------+--------+---------------+
6 rows in set (0.001 sec)

MariaDB [bilet34]> select * from melodii where data_aparitie >= "1990-01-01" and
data_aparitie <= "1999-12-31" order by artist;
+------------+----------------------+-----------+--------+---------------+
| Id_melodie | Titlu | Artist | Durata | Data_aparitie |
+------------+----------------------+-----------+--------+---------------+
| 1022 | Nothing else matters | Metallica | 389 | 1991-08-02 |
| 1254 | Desert rose | Sting | 286 | 1999-09-24 |
+------------+----------------------+-----------+--------+---------------+
2 rows in set (0.001 sec)

MariaDB [bilet34]> delete from melodii where artist = "Deep Purple";


Query OK, 2 rows affected (0.004 sec)

MariaDB [bilet34]> select * from melodii;


+------------+-----------------------+-----------+--------+---------------+
| Id_melodie | Titlu | Artist | Durata | Data_aparitie |
+------------+-----------------------+-----------+--------+---------------+
| 1254 | Desert rose | Sting | 286 | 1999-09-24 |
| 1067 | Every breath you take | Sting | 253 | 1983-06-01 |
| 1198 | Left outside alone | Anastacia | 233 | 2004-03-15 |
| 1022 | Nothing else matters | Metallica | 389 | 1991-08-02 |
+------------+-----------------------+-----------+--------+---------------+
4 rows in set (0.005 sec)

Biletul 33

MariaDB [bilet34]> create database biletul33;


Query OK, 1 row affected (0.006 sec)
MariaDB [bilet34]> use biletul3;
ERROR 1049 (42000): Unknown database 'biletul3'
MariaDB [bilet34]> use biletul33;
Database changed
MariaDB [biletul33]> create table locuinte (Id_locuinta int(4), Tip text(20),
Suprafata int(4), Nr_camere int(2), Pret_lunar float(7,2), Disponibila char(1));
Query OK, 0 rows affected (0.216 sec)

MariaDB [biletul33]> insert into locuinte values (4332, "Apartament", 85, 3,


95.75, "Y");
Query OK, 1 row affected (0.119 sec)

MariaDB [biletul33]> insert into locuinte values (3211, "Vila", 130, 6, 245.00,
"N");
Query OK, 1 row affected (0.001 sec)

MariaDB [biletul33]> insert into locuinte values (3445, "Garsoniera", 45, 1, 49.30,
"N");
Query OK, 1 row affected (0.001 sec)

MariaDB [biletul33]> insert into locuinte values (3624, "Apartament", 65, 3, 87.00,
"Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [biletul33]> insert into locuinte values (3575, "Apartament", 70, 2,


115.50, "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [biletul33]> insert into locuinte values (4578, "Garsoniera", 55, 1, 55.90,
"Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [biletul33]> select * from locuinte;


+-------------+------------+-----------+-----------+------------+-------------+
| Id_locuinta | Tip | Suprafata | Nr_camere | Pret_lunar | Disponibila |
+-------------+------------+-----------+-----------+------------+-------------+
| 4332 | Apartament | 85 | 3 | 95.75 | Y |
| 3211 | Vila | 130 | 6 | 245.00 | N |
| 3445 | Garsoniera | 45 | 1 | 49.30 | N |
| 3624 | Apartament | 65 | 3 | 87.00 | Y |
| 3575 | Apartament | 70 | 2 | 115.50 | N |
| 4578 | Garsoniera | 55 | 1 | 55.90 | Y |
+-------------+------------+-----------+-----------+------------+-------------+
6 rows in set (0.001 sec)

MariaDB [biletul33]> select * from locuinte where disponibila = "Y" order by


pret_lunar;
+-------------+------------+-----------+-----------+------------+-------------+
| Id_locuinta | Tip | Suprafata | Nr_camere | Pret_lunar | Disponibila |
+-------------+------------+-----------+-----------+------------+-------------+
| 4578 | Garsoniera | 55 | 1 | 55.90 | Y |
| 3624 | Apartament | 65 | 3 | 87.00 | Y |
| 4332 | Apartament | 85 | 3 | 95.75 | Y |
+-------------+------------+-----------+-----------+------------+-------------+
3 rows in set (0.001 sec)

MariaDB [biletul33]> update locuinte set pret_lunar = pret_lunar - pret_lunar * 4 /


100 where tip = "Garsoniera" and disponibila = "N";
Query OK, 1 row affected (0.001 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [biletul33]> select * from locuinte;


+-------------+------------+-----------+-----------+------------+-------------+
| Id_locuinta | Tip | Suprafata | Nr_camere | Pret_lunar | Disponibila |
+-------------+------------+-----------+-----------+------------+-------------+
| 4332 | Apartament | 85 | 3 | 95.75 | Y |
| 3211 | Vila | 130 | 6 | 245.00 | N |
| 3445 | Garsoniera | 45 | 1 | 47.33 | N |
| 3624 | Apartament | 65 | 3 | 87.00 | Y |
| 3575 | Apartament | 70 | 2 | 115.50 | N |
| 4578 | Garsoniera | 55 | 1 | 55.90 | Y |
+-------------+------------+-----------+-----------+------------+-------------+
6 rows in set (0.001 sec)

Biletul 32

MariaDB [(none)]> use bilet32;


Database changed
MariaDB [bilet32]> create table polite (Id_polita int(4), Societate text(50),
Durata int(2), Pret float(7,2), Oferta_actuala char(1));
Query OK, 0 rows affected (0.052 sec)

MariaDB [bilet32]> insert into polite values ( 32, "Ardaf", 6, 189.10, "Y");
Query OK, 1 row affected (0.003 sec)

MariaDB [bilet32]> insert into polite values ( 542, "Asirom", 12, 294.00, "Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet32]> insert into polite values ( 353, "Euroins", 6, 197.40, "N");
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet32]> insert into polite values ( 1024, "Asirom", 6, 205.70, "Y");
Query OK, 1 row affected (0.078 sec)

MariaDB [bilet32]> insert into polite values ( 893, "Carpatica", 12, 310.00, "Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet32]> insert into polite values ( 871, "Asirom", 6, 198.70, "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet32]> select * from polite ;


+-----------+-----------+--------+--------+----------------+
| Id_polita | Societate | Durata | Pret | Oferta_actuala |
+-----------+-----------+--------+--------+----------------+
| 32 | Ardaf | 6 | 189.10 | Y |
| 542 | Asirom | 12 | 294.00 | Y |
| 353 | Euroins | 6 | 197.40 | N |
| 1024 | Asirom | 6 | 205.70 | Y |
| 893 | Carpatica | 12 | 310.00 | Y |
| 871 | Asirom | 6 | 198.70 | N |
+-----------+-----------+--------+--------+----------------+
6 rows in set (0.001 sec)

MariaDB [bilet32]> select * from polite where oferta_actuala = "Y" and durata = 6
order by pret desc;
+-----------+-----------+--------+--------+----------------+
| Id_polita | Societate | Durata | Pret | Oferta_actuala |
+-----------+-----------+--------+--------+----------------+
| 1024 | Asirom | 6 | 205.70 | Y |
| 32 | Ardaf | 6 | 189.10 | Y |
+-----------+-----------+--------+--------+----------------+
2 rows in set (0.001 sec)

MariaDB [bilet32]> update polite set pret = pret + pret * 5 / 100 where durata =
12;
Query OK, 2 rows affected (0.009 sec)
Rows matched: 2 Changed: 2 Warnings: 0

MariaDB [bilet32]> select * from polite ;


+-----------+-----------+--------+--------+----------------+
| Id_polita | Societate | Durata | Pret | Oferta_actuala |
+-----------+-----------+--------+--------+----------------+
| 32 | Ardaf | 6 | 189.10 | Y |
| 542 | Asirom | 12 | 308.70 | Y |
| 353 | Euroins | 6 | 197.40 | N |
| 1024 | Asirom | 6 | 205.70 | Y |
| 893 | Carpatica | 12 | 325.50 | Y |
| 871 | Asirom | 6 | 198.70 | N |
+-----------+-----------+--------+--------+----------------+
6 rows in set (0.021 sec)

Biletul 31

MariaDB [bilet32]> create database bilet31;


Query OK, 1 row affected (0.072 sec)

MariaDB [bilet32]> use bilet31;


Database changed
MariaDB [bilet31]> create table studenti (Nr_matricol int(5), Nume text(50),
Prenume text(50), Facultate text(60), Data_inscrierii date);
Query OK, 0 rows affected (1.258 sec)

MariaDB [bilet31]> insert into studenti values ( 10530, "Chelan", "Marius",


"Medicina", "2014-07-05");
Query OK, 1 row affected (0.236 sec)

MariaDB [bilet31]> insert into studenti values ( 9775, "Ciobanu", "Nicusor",


"Politehnica", "2015-07-04");
Query OK, 1 row affected (0.030 sec)

MariaDB [bilet31]> insert into studenti values ( 5662, "Zaharia", "Andreea",


"Medicina", "2009-07-02");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet31]> insert into studenti values ( 11207, "Sava", "Eugen",


"Matematica-Informatica", "2014-07-05");
Query OK, 1 row affected (0.009 sec)

MariaDB [bilet31]> insert into studenti values ( 7678, "Stefanescu", "Andreea",


"Drept", "2013-07-03");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet31]> insert into studenti values ( 8878, "Turcu", "Bianca-Gabriela",


"Politehnica", "2013-07-03");
Query OK, 1 row affected (0.002 sec)
MariaDB [bilet31]> select * from studenti;
+-------------+------------+-----------------+------------------------
+-----------------+
| Nr_matricol | Nume | Prenume | Facultate |
Data_inscrierii |
+-------------+------------+-----------------+------------------------
+-----------------+
| 10530 | Chelan | Marius | Medicina | 2014-07-05
|
| 9775 | Ciobanu | Nicusor | Politehnica | 2015-07-04
|
| 5662 | Zaharia | Andreea | Medicina | 2009-07-02
|
| 11207 | Sava | Eugen | Matematica-Informatica | 2014-07-05
|
| 7678 | Stefanescu | Andreea | Drept | 2013-07-03
|
| 8878 | Turcu | Bianca-Gabriela | Politehnica | 2013-07-03
|
+-------------+------------+-----------------+------------------------
+-----------------+
6 rows in set (0.008 sec)

MariaDB [bilet31]> select * from studenti where facultate = "Medicina" order by


nume;
+-------------+---------+---------+-----------+-----------------+
| Nr_matricol | Nume | Prenume | Facultate | Data_inscrierii |
+-------------+---------+---------+-----------+-----------------+
| 10530 | Chelan | Marius | Medicina | 2014-07-05 |
| 5662 | Zaharia | Andreea | Medicina | 2009-07-02 |
+-------------+---------+---------+-----------+-----------------+
2 rows in set (0.004 sec)

MariaDB [bilet31]> update studenti set facultate = "Finante-banci" where


nr_matricol = 5662;
Query OK, 1 row affected (0.026 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [bilet31]>
MariaDB [bilet31]> select * from studenti;
+-------------+------------+-----------------+------------------------
+-----------------+
| Nr_matricol | Nume | Prenume | Facultate |
Data_inscrierii |
+-------------+------------+-----------------+------------------------
+-----------------+
| 10530 | Chelan | Marius | Medicina | 2014-07-05
|
| 9775 | Ciobanu | Nicusor | Politehnica | 2015-07-04
|
| 5662 | Zaharia | Andreea | Finante-banci | 2009-07-02
|
| 11207 | Sava | Eugen | Matematica-Informatica | 2014-07-05
|
| 7678 | Stefanescu | Andreea | Drept | 2013-07-03
|
| 8878 | Turcu | Bianca-Gabriela | Politehnica | 2013-07-03
|
+-------------+------------+-----------------+------------------------
+-----------------+
6 rows in set (0.001 sec)

Biletul 30

MariaDB [(none)]> create database bilet30;


Query OK, 1 row affected (0.112 sec)

MariaDB [(none)]> use bilet30;


Database changed
MariaDB [bilet30]> create table reparatii (Id_reparatie int, Descriere text(100),
Cost float, Data_finalizare date, Garantie int);
Query OK, 0 rows affected (0.251 sec)

MariaDB [bilet30]> insert into reparatii values ( 3441, "Reparatie sistem frana",
128.40, "2015-05-23", 12);
Query OK, 1 row affected (0.529 sec)

MariaDB [bilet30]> insert into reparatii values ( 3442, "Schimb filtre aer
conditionat", 39.89, "2015-05-28", 6);
Query OK, 1 row affected (0.061 sec)

MariaDB [bilet30]> insert into reparatii values ( 3422, "Indreptare aripa stanga
fata", 244.10, "2015-05-31", 36);
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet30]> insert into reparatii values ( 3478, "Reglare unghi de fuga",
299.00, "2015-05-24", 24);
Query OK, 1 row affected (0.003 sec)

MariaDB [bilet30]> insert into reparatii values ( 3416, "Reparatie sistem de


lumini", 248.45, "2015-05-23", 6);
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet30]> insert into reparatii values ( 3466, "Schimb set distributie",
455.00, "2015-05-19", 36);
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet30]> select * from reparatii where cost >= 200 order by
data_finalizare;
+--------------+------------------------------+--------+-----------------
+----------+
| Id_reparatie | Descriere | Cost | Data_finalizare | Garantie
|
+--------------+------------------------------+--------+-----------------
+----------+
| 3466 | Schimb set distributie | 455.00 | 2015-05-19 | 36
|
| 3416 | Reparatie sistem de lumini | 248.45 | 2015-05-23 | 6
|
| 3478 | Reglare unghi de fuga | 299.00 | 2015-05-24 | 24
|
| 3422 | Indreptare aripa stanga fata | 244.10 | 2015-05-31 | 36
|
+--------------+------------------------------+--------+-----------------
+----------+
4 rows in set (0.173 sec)
MariaDB [bilet30]>
MariaDB [bilet30]> select * from reparatii where cost >= 200 order by
data_finalizare;
+--------------+------------------------------+--------+-----------------
+----------+
| Id_reparatie | Descriere | Cost | Data_finalizare | Garantie
|
+--------------+------------------------------+--------+-----------------
+----------+
| 3466 | Schimb set distributie | 455.00 | 2015-05-19 | 36
|
| 3416 | Reparatie sistem de lumini | 248.45 | 2015-05-23 | 6
|
| 3478 | Reglare unghi de fuga | 299.00 | 2015-05-24 | 24
|
| 3422 | Indreptare aripa stanga fata | 244.10 | 2015-05-31 | 36
|
+--------------+------------------------------+--------+-----------------
+----------+
4 rows in set (0.001 sec)

MariaDB [bilet30]>
MariaDB [bilet30]> select * from reparatii;
+--------------+-------------------------------+--------+-----------------
+----------+
| Id_reparatie | Descriere | Cost | Data_finalizare |
Garantie |
+--------------+-------------------------------+--------+-----------------
+----------+
| 3441 | Reparatie sistem frana | 128.40 | 2015-05-23 |
12 |
| 3442 | Schimb filtre aer conditionat | 39.89 | 2015-05-28 |
6 |
| 3422 | Indreptare aripa stanga fata | 244.10 | 2015-05-31 |
36 |
| 3478 | Reglare unghi de fuga | 299.00 | 2015-05-24 |
24 |
| 3416 | Reparatie sistem de lumini | 248.45 | 2015-05-23 |
6 |
| 3466 | Schimb set distributie | 455.00 | 2015-05-19 |
36 |
+--------------+-------------------------------+--------+-----------------
+----------+
6 rows in set (0.015 sec)

MariaDB [bilet30]> delete from reparatii where garantie / 12 <= 1;


Query OK, 3 rows affected (0.006 sec)

MariaDB [bilet30]> select * from reparatii;


+--------------+------------------------------+--------+-----------------
+----------+
| Id_reparatie | Descriere | Cost | Data_finalizare | Garantie
|
+--------------+------------------------------+--------+-----------------
+----------+
| 3422 | Indreptare aripa stanga fata | 244.10 | 2015-05-31 | 36
|
| 3478 | Reglare unghi de fuga | 299.00 | 2015-05-24 | 24
|
| 3466 | Schimb set distributie | 455.00 | 2015-05-19 | 36
|
+--------------+------------------------------+--------+-----------------
+----------+
3 rows in set (0.002 sec)

Biletul 29

MariaDB [bilet30]> create database bilet29;


Query OK, 1 row affected (0.013 sec)

MariaDB [bilet30]> use bilet29;


Database changed
MariaDB [bilet29]> create table mecanici (Id_mecanic int, Nume text(60), Salariu
float, Data_angajarii date, Experienta char(1));
Query OK, 0 rows affected (0.060 sec)

MariaDB [bilet29]> insert into mecanici values (7, "Coanda Vlad", 2086.60, "2003-
08-12", "Y");
Query OK, 1 row affected (0.005 sec)

MariaDB [bilet29]> insert into mecanici values (14, "Apostolescu Lucian", 1805.40,
"2008-09-22", "N");
Query OK, 1 row affected (0.006 sec)

MariaDB [bilet29]> insert into mecanici values (15, "Dobre Cosmin", 1754.30, "2003-
12-14", "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet29]> insert into mecanici values (12, "Murgulescu Ioana", 1945.00,
"2003-10-24", "Y");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet29]> insert into mecanici values (19, "Matei Cosmin", 978.15, "2010-
04-09", "N");
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet29]> insert into mecanici values (3, "Chiran Radu", 1218.30, "2006-
05-02", "N");
Query OK, 1 row affected (0.004 sec)

MariaDB [bilet29]> select * from mecanici where Experienta = "Y" order by


Data_angajarii;
+------------+------------------+---------+----------------+------------+
| Id_mecanic | Nume | Salariu | Data_angajarii | Experienta |
+------------+------------------+---------+----------------+------------+
| 7 | Coanda Vlad | 2086.6 | 2003-08-12 | Y |
| 12 | Murgulescu Ioana | 1945 | 2003-10-24 | Y |
+------------+------------------+---------+----------------+------------+
2 rows in set (0.028 sec)

MariaDB [bilet29]> select * from mecanici;


+------------+--------------------+---------+----------------+------------+
| Id_mecanic | Nume | Salariu | Data_angajarii | Experienta |
+------------+--------------------+---------+----------------+------------+
| 7 | Coanda Vlad | 2086.6 | 2003-08-12 | Y |
| 14 | Apostolescu Lucian | 1805.4 | 2008-09-22 | N |
| 15 | Dobre Cosmin | 1754.3 | 2003-12-14 | N |
| 12 | Murgulescu Ioana | 1945 | 2003-10-24 | Y |
| 19 | Matei Cosmin | 978.15 | 2010-04-09 | N |
| 3 | Chiran Radu | 1218.3 | 2006-05-02 | N |
+------------+--------------------+---------+----------------+------------+
6 rows in set (0.001 sec)

MariaDB [bilet29]> update mecanici set salariu = salariu + salariu * 7 / 100;


Query OK, 6 rows affected (0.005 sec)
Rows matched: 6 Changed: 6 Warnings: 0

MariaDB [bilet29]> select * from mecanici;


+------------+--------------------+---------+----------------+------------+
| Id_mecanic | Nume | Salariu | Data_angajarii | Experienta |
+------------+--------------------+---------+----------------+------------+
| 7 | Coanda Vlad | 2232.66 | 2003-08-12 | Y |
| 14 | Apostolescu Lucian | 1931.78 | 2008-09-22 | N |
| 15 | Dobre Cosmin | 1877.1 | 2003-12-14 | N |
| 12 | Murgulescu Ioana | 2081.15 | 2003-10-24 | Y |
| 19 | Matei Cosmin | 1046.62 | 2010-04-09 | N |
| 3 | Chiran Radu | 1303.58 | 2006-05-02 | N |
+------------+--------------------+---------+----------------+------------+
6 rows in set (0.001 sec)

Biletul 28

MariaDB [(none)]> use bilet29;


Database changed
MariaDB [bilet29]> insert into masini values (763, "Opel Vectra", 6000, "2011-11-
11", "Y");
ERROR 1146 (42S02): Table 'bilet29.masini' doesn't exist
MariaDB [bilet29]> use bilet28;
Database changed
MariaDB [bilet28]> insert into masini values (763, "Opel Vectra", 6000, "2011-11-
11", "Y");
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet28]> insert into masini values (822, "BMW seria 3", 3500, "2010-02-
26", "N");
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet28]> insert into masini values (671, "Skoda Octavia", 4000, "2009-07-
07", "Y");
Query OK, 1 row affected (0.067 sec)

MariaDB [bilet28]> select * from masini;


+-------------+---------------+------+------------+------------+
| Nr_inventar | Marca | Pret | Data_fabr | Verif_tehn |
+-------------+---------------+------+------------+------------+
| 433 | Skoda Octavia | 3000 | 2008-07-12 | Y |
| 405 | BMW seria 3 | 1500 | 2007-05-05 | N |
| 536 | Mazda 3 | 2000 | 2009-04-16 | Y |
| 763 | Opel Vectra | 6000 | 2011-11-11 | Y |
| 822 | BMW seria 3 | 3500 | 2010-02-26 | N |
| 671 | Skoda Octavia | 4000 | 2009-07-07 | Y |
+-------------+---------------+------+------------+------------+
6 rows in set (0.001 sec)

MariaDB [bilet28]> select * from masini where year(Data_fabr)>=2009;


+-------------+---------------+------+------------+------------+
| Nr_inventar | Marca | Pret | Data_fabr | Verif_tehn |
+-------------+---------------+------+------------+------------+
| 536 | Mazda 3 | 2000 | 2009-04-16 | Y |
| 763 | Opel Vectra | 6000 | 2011-11-11 | Y |
| 822 | BMW seria 3 | 3500 | 2010-02-26 | N |
| 671 | Skoda Octavia | 4000 | 2009-07-07 | Y |
+-------------+---------------+------+------------+------------+
4 rows in set (0.003 sec)

MariaDB [bilet28]> update masini set Pret = Pret - Pret * 7 / 100 where Verif_tehn
= "N";
Query OK, 2 rows affected (0.003 sec)
Rows matched: 2 Changed: 2 Warnings: 0

MariaDB [bilet28]> select * from masini;


+-------------+---------------+------+------------+------------+
| Nr_inventar | Marca | Pret | Data_fabr | Verif_tehn |
+-------------+---------------+------+------------+------------+
| 433 | Skoda Octavia | 3000 | 2008-07-12 | Y |
| 405 | BMW seria 3 | 1395 | 2007-05-05 | N |
| 536 | Mazda 3 | 2000 | 2009-04-16 | Y |
| 763 | Opel Vectra | 6000 | 2011-11-11 | Y |
| 822 | BMW seria 3 | 3255 | 2010-02-26 | N |
| 671 | Skoda Octavia | 4000 | 2009-07-07 | Y |
+-------------+---------------+------+------------+------------+
6 rows in set (0.016 sec)

Biletul 27

MariaDB [(none)]> create database bilet27;


Query OK, 1 row affected (0.044 sec)

MariaDB [(none)]> use bilet27;


Database changed
MariaDB [bilet27]> create table materiale (id_material int(5), denumire text(60),
pret_buc float(5,2), nr_buc int(3), produs text(40));
Query OK, 0 rows affected (0.079 sec)

MariaDB [bilet27]> insert into materiale values (4435, 'Surub 10mm', 0.55, 48,
'raft');
Query OK, 1 row affected (0.255 sec)

MariaDB [bilet27]> insert into materiale values (399, 'Piulita 10mm', 0.24, 48,
'raft');
Query OK, 1 row affected (0.009 sec)

MariaDB [bilet27]> insert into materiale values (3345, 'Surub 11mm', 0.60, 8,
'scaun');
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet27]> insert into materiale values (734, 'Placute de fixare', 0.74, 4,
'raft');
Query OK, 1 row affected (0.002 sec)

MariaDB [bilet27]> insert into materiale values (1083, 'Cheie 10-11mm', 2, 1,


'scaun');
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet27]> insert into materiale values (866, 'Cheie 10-11mm', 2, 1,


'raft');
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet27]> select * from materiale;


+-------------+-------------------+----------+--------+--------+
| id_material | denumire | pret_buc | nr_buc | produs |
+-------------+-------------------+----------+--------+--------+
| 4435 | Surub 10mm | 0.55 | 48 | raft |
| 399 | Piulita 10mm | 0.24 | 48 | raft |
| 3345 | Surub 11mm | 0.60 | 8 | scaun |
| 734 | Placute de fixare | 0.74 | 4 | raft |
| 1083 | Cheie 10-11mm | 2.00 | 1 | scaun |
| 866 | Cheie 10-11mm | 2.00 | 1 | raft |
+-------------+-------------------+----------+--------+--------+
6 rows in set (0.017 sec)

MariaDB [bilet27]> update materiale set nr_buc = 8 where denumire = 'Placute de


fixare' and produs = 'raft';
Query OK, 1 row affected (0.008 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [bilet27]> select * from materiale;


+-------------+-------------------+----------+--------+--------+
| id_material | denumire | pret_buc | nr_buc | produs |
+-------------+-------------------+----------+--------+--------+
| 4435 | Surub 10mm | 0.55 | 48 | raft |
| 399 | Piulita 10mm | 0.24 | 48 | raft |
| 3345 | Surub 11mm | 0.60 | 8 | scaun |
| 734 | Placute de fixare | 0.74 | 8 | raft |
| 1083 | Cheie 10-11mm | 2.00 | 1 | scaun |
| 866 | Cheie 10-11mm | 2.00 | 1 | raft |
+-------------+-------------------+----------+--------+--------+
6 rows in set (0.002 sec)

MariaDB [bilet27]> select produs,sum(pret_buc) as pret_total from materiale group


by produs;
+--------+------------+
| produs | pret_total |
+--------+------------+
| raft | 3.53 |
| scaun | 2.60 |
+--------+------------+
2 rows in set (0.159 sec)

Biletul 26

MariaDB [bilet27]> create database bilet26;


Query OK, 1 row affected (0.019 sec)

MariaDB [bilet27]> use bilet 26;


ERROR 1049 (42000): Unknown database 'bilet'
MariaDB [bilet27]> use bilet26;
Database changed
MariaDB [bilet26]> create table piese (id_piesa int, denumire text(60), pret
float, stare text(20), nou char);
Query OK, 0 rows affected (0.120 sec)
MariaDB [bilet26]> insert into piese values (1332, 'Burduf planetara Ford', 15.78,
'F.B.', 'Y');
Query OK, 1 row affected (0.005 sec)

MariaDB [bilet26]> insert into piese values (322, 'Arbore cotit Dacia', 743.50,
'B.', 'N');
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet26]> insert into piese values (1723, 'Culbutori Dacia', 4.15, 'F.B.',
'Y');
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet26]> insert into piese values (2116, 'Segmenti motor Ford', 23.40,
'F.B.', 'N');
Query OK, 1 row affected (0.014 sec)

MariaDB [bilet26]> insert into piese values (543, 'Set motor Ford', 823.60, 'F.B.',
'Y');
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet26]> insert into piese values (423, 'Yala usa Renault', 49.25,
'F.B.', 'Y');
Query OK, 1 row affected (0.001 sec)

MariaDB [bilet26]> select * from piese;


+----------+-----------------------+-------+-------+------+
| id_piesa | denumire | pret | stare | nou |
+----------+-----------------------+-------+-------+------+
| 1332 | Burduf planetara Ford | 15.78 | F.B. | Y |
| 322 | Arbore cotit Dacia | 743.5 | B. | N |
| 1723 | Culbutori Dacia | 4.15 | F.B. | Y |
| 2116 | Segmenti motor Ford | 23.4 | F.B. | N |
| 543 | Set motor Ford | 823.6 | F.B. | Y |
| 423 | Yala usa Renault | 49.25 | F.B. | Y |
+----------+-----------------------+-------+-------+------+
6 rows in set (0.001 sec)

MariaDB [bilet26]> select * from piese where nou = 'Y';


+----------+-----------------------+-------+-------+------+
| id_piesa | denumire | pret | stare | nou |
+----------+-----------------------+-------+-------+------+
| 1332 | Burduf planetara Ford | 15.78 | F.B. | Y |
| 1723 | Culbutori Dacia | 4.15 | F.B. | Y |
| 543 | Set motor Ford | 823.6 | F.B. | Y |
| 423 | Yala usa Renault | 49.25 | F.B. | Y |
+----------+-----------------------+-------+-------+------+
4 rows in set (0.005 sec)

MariaDB [bilet26]> delete from piese where stare != 'F.B.' and nou = 'N';
Query OK, 1 row affected (0.003 sec)

MariaDB [bilet26]> select * from piese;


+----------+-----------------------+-------+-------+------+
| id_piesa | denumire | pret | stare | nou |
+----------+-----------------------+-------+-------+------+
| 1332 | Burduf planetara Ford | 15.78 | F.B. | Y |
| 1723 | Culbutori Dacia | 4.15 | F.B. | Y |
| 2116 | Segmenti motor Ford | 23.4 | F.B. | N |
| 543 | Set motor Ford | 823.6 | F.B. | Y |
| 423 | Yala usa Renault | 49.25 | F.B. | Y |
+----------+-----------------------+-------+-------+------+
5 rows in set (0.001 sec)

You might also like