SQL COMMANDSCREATE TABLE COMMANDSCase Solved Tablecreate table case_solved(case_solved_id number primary key,case_id numbe...
address text(50) not null,sex text(5) not null,phone_no number not null);Daily diary tablecreate table daily_diary(s_no nu...
fir_no number references fir(fir_no),duty_officer_id number references employee(emp_id),primary key(fir_no,duty_officer_id...
vehicle_no number not null,date_emopound date not null,date_release date not null,under_section text(30) not null);FIR Inv...
INSERTION COMMANDSDesignation tableINSERT INTO designation ( emp_id, rank, salary, date_joined )VALUES (1231, constabler, ...
DAILY_DIARYINSERT INTO daily_diary ( s_no, _date, emp_id, duty, duty_shift )VALUES (23, 24-04-2011, 1231, 8, morning);EMPO...
Data query languageSELECT emp_name, addressFROM employee;OutputSELECT *FROM empoundWHERE fir_no<1035;SELECT *FROM designat...
SELECT DISTINCT empound_idFROM empound_officer;OutputSELECT *FROM complaintantWHERE complaintant_name=kalpana And fathers_...
Upcoming SlideShare
Loading in...5
×

Sql commands

677

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
677
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
40
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Sql commands"

  1. 1. SQL COMMANDSCREATE TABLE COMMANDSCase Solved Tablecreate table case_solved(case_solved_id number primary key,case_id number not null unique references case(case_id),fir_no number not null unique,date_case_closed date not null);Case Tablecreate table case(case_id number primary key,fir_no number not null references fir(fir_no),case_incharge_id number not null unique,date_case_open date not null);Complainant tablecreate table complainant(fir_no number primary key references fir(fir_no),complaintant_name text(30) not null,fathers_name text(30) not null,
  2. 2. address text(50) not null,sex text(5) not null,phone_no number not null);Daily diary tablecreate table daily_diary(s_no number primary key,_date date not null,emp_id number not null references employee(emp_id),duty text(30) NOT NULL,duty_shift text(30) not null);Designation Tablecreate table designation(emp_id number primary key references employee(emp_id),rank text(20) not null,salary number not null,date_joined date not null);Duty Officer Tablecreate table duty_officer(
  3. 3. fir_no number references fir(fir_no),duty_officer_id number references employee(emp_id),primary key(fir_no,duty_officer_id));Employee tablecreate table employee(emp_id number primary key,emp_name text(30) not null,sex text(5) not null,address text(100) not null,phone_no number not null);Empound Officer Tablecreate table empound_officer(empound_id number references empound(empound_id),investigation_officer_id number references employee(emp_id),primary key(empound_id,investigation_officer_id));Empound Tablecreate table empound(empound_id number primary key,fir_no number not null references fir(fir_no),
  4. 4. vehicle_no number not null,date_emopound date not null,date_release date not null,under_section text(30) not null);FIR Investigation Officer Tablecreate table fir_investigation_officer(fir_no number references fir(fir_no),investigation_officer_id number references employee(emp_id),primary key(fir_no,investigation_officer_id));FIR Tablecreate table fir(fir_no number primary key,date_of_fir date not null,date_of_crime date not null,under_section text(20) not null,details text(50));
  5. 5. INSERTION COMMANDSDesignation tableINSERT INTO designation ( emp_id, rank, salary, date_joined )VALUES (1231, constabler, 20000, 1-6-1995);EMPLOYEE TABLEINSERT INTO employee ( emp_id, emp_name, address, sex, phone_no )VALUES (1231, rajesh kumar, model town ludhiana, male, 9592477245);FIR TABLEINSERT INTO fir ( fir_no, date_of_fir, date_of_crime, under_section, details )VALUES (1023, 24-4-2011, 21-4-2011, 420, robbery);EMPOUND_OFFICERINSERT INTO empound_officer ( empound_id, investigation_officer_id )VALUES (1342, 1231);FIR_INVESTIGATION_OFFICERINSERT INTO fir_investigation_officer ( fir_no, investigation_officer_id )VALUES (1023, 1231);DUTY_OFFICERINSERT INTO duty_officer ( fir_no, duty_officer_id )VALUES (1023, 1231);
  6. 6. DAILY_DIARYINSERT INTO daily_diary ( s_no, _date, emp_id, duty, duty_shift )VALUES (23, 24-04-2011, 1231, 8, morning);EMPOUNDINSERT INTO empound ( empound_id, fir_no, vehicle_no, under_section, date_empound, date_release )VALUES (1342, 1023, 3465, 356, 24-4-2011, 21-04-2011);COMPLAINTANTINSERT INTO complaintant ( fir_no, complaintant_name, fathers_name, address, sex, phone_no )VALUES (1023, Ravi kumar, parkash kumar, haibowal ludhiana, male, 9834562786);CASEINSERT INTO case ( case_id, fir_no, case_incharge_id, date_case_open )VALUES (234, 1023, 1231, 24-4-2011);CASE_SOLVEDINSERT INTO case_solved ( case_solved_id, case_id, fir_no, date_case_closed )VALUES (251, 234, 1023, 27-5-2011);
  7. 7. Data query languageSELECT emp_name, addressFROM employee;OutputSELECT *FROM empoundWHERE fir_no<1035;SELECT *FROM designation;
  8. 8. SELECT DISTINCT empound_idFROM empound_officer;OutputSELECT *FROM complaintantWHERE complaintant_name=kalpana And fathers_name=niraj sharma;SELECT *FROM complaintantWHERE complaintant_name=rajesh kumar Or fathers_name=niraj sharma;Output

×