If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > SQL question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-12, 06:25
rodi rodi is offline
Registered User
 
Join Date: Jan 2012
Posts: 1
Question SQL question

Hello i study now database and i have a assignment : i have a table:
CREATE TABLE employees(
ID INTEGER NOT NULL,
FirstName VARCHAR (25) NOT NULL,
SecondName VARCHAR (25) NOT NULL,
CNMU VARCHAR (13) NOT NULL,
Adres VARCHAR (25) NOT NULL,
Home VARCHAR (25) NOT NULL,
DateOfBirth DATE,
PlaceOfBirght VARCHAR (50),
NrTelefon VARCHAR (20),
TrainingSchool VARCHAR (20),
CivilStatus VARCHAR (20),
Sex VARCHAR (10),
SalarMax NUMERIC (10),
SalarMediu NUMERIC (10));


Write the SQL query that will presents CivilStatus at least 4 employees.



i right:

select* from test. employees where civilstatus='married' or civilstatus ='notmarried' or civilstatus ='divorced' or civilstatus ='widow' group by civilstatus;

byt the answere was:
Unfortunately exercise is incorrect. Exercise can be achieved by grouping and aggregate function.

can you halp me how it should be????????
i tray : select id,firstname,civilstatus from test.employees group by civilstatus ;

and give me at lists 4 employees byt how can i coose to show me al the employees which are with civillstatus married??????(i have in my table 5 of them).i thinc it should be enought.
thank you very much.
Reply With Quote
  #2 (permalink)  
Old 01-25-12, 06:55
sonic10 sonic10 is offline
Registered User
 
Join Date: Apr 2005
Posts: 29
Here is one way ..

PHP Code:
'select * from employees where CivilStatus = "married" order by SecondName limit 4;'
__________________
Web Database Software - Build your own php mysql database.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On