0% found this document useful (0 votes)
7 views2 pages

COMMANDSihninikn

Uploaded by

Saketh ROck
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

COMMANDSihninikn

Uploaded by

Saketh ROck
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

To Create a Sample Student Data_Base:

-- create table for students


CREATE TABLE students (
student_id NUMBER(5) PRIMARY KEY,
student_name VARCHAR2(50),
student_email VARCHAR2(50),
student_phone VARCHAR2(20),
student_dob DATE
);

TO INSERT DATA INTO STUDENT DATABASE:


-- insert sample data
INSERT INTO students (student_id, student_name, student_email, student_phone, student_dob)
VALUES (1, 'John Doe', '[email protected]', '555-1234', TO_DATE('1999-05-01', 'yyyy-mm-dd'));

INSERT INTO students (student_id, student_name, student_email, student_phone, student_dob)


VALUES (2, 'Jane Smith', '[email protected]', '555-5678', TO_DATE('2000-09-15', 'yyyy-mm-dd'));

INSERT INTO students (student_id, student_name, student_email, student_phone, student_dob)


VALUES (3, 'Mark Johnson', '[email protected]', '555-9876', TO_DATE('1998-11-30', 'yyyy-
mm-dd'));

INSERT INTO students (student_id, student_name, student_email, student_phone, student_dob)


VALUES (4, 'Samantha Lee', '[email protected]', '555-4321', TO_DATE('1997-02-14', 'yyyy-mm-dd'));

-- display all students


SELECT * FROM students;

INSERTING DATA BY SPECIFIC COLUMN:


Insert into students(STUDENT_ID,STUDENT_NAME) values(5,'saketh');

DELETING DATA OF A SPECIFIC ROW USING 'WHERE"


DELETE FROM <DATABASE_NAME> WHERE <ROW_CONTENT>;

APPLICATION:
DELETE FROM STUDENTS WHERE STUDENT_ID=5;
UPDATE THE DATA OF A PARTICUALR ROW USING "WHERE'
UPDATE <DATABASE_NAME> set <COL>=<VALUE> WHERE <SEARCH_CONDITION>;

APPLICATION:
UPDATE STUDENTS set STUDENT_PHONE='8019269778' where STUDENT_ID=2;

You might also like