Select Data From Table



--create table with the specified fields
create table aTable (id integer , 
name char(30), 
surname char(30), 
address char(30),
salary numeric);
--insert data to the coresponding fields
insert into aTable values(1,'John','John_Surname','J_Address',234.554);
insert into aTable values(2,'Tim','Tim_Surname','T_Address',3445.455);
insert into aTable values(3,'Gary','Gary_Surname','G_Address',33234.33445);
insert into aTable values(4,'Mary','Mary_Surname','M_Address',234.45);
--select all the data from the table
select * from aTable;
--selects all records with salary > 5000
select * from aTable where salary > 5000;
--selects name and surname of the employee who gains more than 5000
select name, surname from aTable where salary > 5000;
--select all records in which surname begins with G
select * from aTable where surname like 'G%';
--select all records in which surname begins with T 
select * from aTable where address like 'T%';



Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου