Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
9.12.2020
create table Produs( idprodus integer, denumire varchar(20), pret integer, furnizor varchar(20), TVA integer, primary key (idprodus)); insert into Produs(idprodus, Denumire, Pret, Furnizor) values (111, 'Duster', 10000, 'Dacia'), (112, 'BMW', 10001, 'Seria 3'), (113, 'Audi', 80, 'Seria 1'), (114, 'Lemne', 45, 'Trei_Brazi_SRL'), (115, 'Mercedes', 42, 'Seria 124214213'), (116, 'Aschii', 444, 'Trei_Brazi_SRL'), (117, 'Alt_Duster', 540, 'Dacia'); DELETE FROM Produs WHERE pret >= 100; update Produs set Pret = Pret + (pret * 1/10) where Furnizor = 'Trei_Brazi_SRL'; select denumire, furnizor from Produs order by denumire asc , furnizor asc; select pret from Produs order by pret desc; select denumire, pret from Produs where pret>=10 and pret<=100 and furnizor='Trei_Brazi_SRL'; select denumire, pret from Produs where furnizor='Trei_Brazi_SRL' or furnizor='Dacia'; select * from Produs; create table Vanzare( idvanzare integer, idclient integer NOT NULL, idprodus integer NOT NULL, cantitate integer NOT NULL, primary key (idvanzare)); insert into Vanzare(idvanzare, idclient, idprodus, cantitate) values (12, 113, 117, 5); select sum(cantitate) as cantitatevanzare from Vanzare, Produs where vanzare.idprodus=produs.idprodus and produs.denumire='ALT_DUSTER'; select * from Vanzare; create table Client( idclient integer, nume varchar(100) NOT NULL, prenume varchar(100) NOT NULL , judet varchar(20) NOT NULL, telefon varchar(20) NOT NULL, adresa varchar(20), primary key (idclient)); insert into Client(idclient, nume, prenume, judet, telefon) values (113, 'PO', 'PA', 'China', '24059587234'), (114, 'C', 'KA', 'China', '1231237'), (115, 'A', 'KA', 'China', '1231237'), (116, 's', 'KA', 'Japonia', '07070707'), (117, 'qwe', 'K', 'China', '24059587234'), (118, 'd', 'KA', 'China', '1231237'), (119, 'we', 'KA', 'China', '1231237'), (120, 'Ba', 'wsA', 'Japonia', '07070707'), (121, 'c', 'we', 'Korea', '24059587234'), (123, 'Bqwe', 'KA', 'Japonia', '07070707'), (124, 'Bwesd', 'K', 'China', '24059587234'); select top 10 nume, prenume from Client order by nume asc , prenume asc; select nume, prenume, telefon from Client; select distinct judet from Client; select count (*) as numarclienti from Client; select count (idclient) as numarclientidinchina from Client where judet='china'; select * from Client;
run
|
edit
|
history
|
help
0
StackOverflow_53575163
bc160400784
Loading json file into sql server
practice sql_12AUG
Change
test44
Table
i need help
Performance test - select vs while - Get all days between two dates.
FirstTable