0% found this document useful (0 votes)
76 views

Table Creation Pract 1 PDF

The document provides instructions and examples for creating tables and populating them with sample data in Oracle. It also includes exercises for modifying the tables by updating column values and data types, increasing prices by percentages, and displaying selected records or attributes.

Uploaded by

yadava krishnaa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Table Creation Pract 1 PDF

The document provides instructions and examples for creating tables and populating them with sample data in Oracle. It also includes exercises for modifying the tables by updating column values and data types, increasing prices by percentages, and displaying selected records or attributes.

Uploaded by

yadava krishnaa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Create table and populate the value

Replace Table name with your own table name.


Table name (reg_no , stu_name, DOB, city)

Reg_no - integer , student_name – varchar2(20) , DOB – date , city – varchar2(10)

Note (Reg No: 1 entered two times in the table, this data is redundant, can be avoided when you
give primary key constraint, will be covered in upcoming portions)

Reg_no Stu_name DOB City


1 Amy 19-10-1988 Hyderabad
1 Amy 19-10-1988 Hyderabad
2 Krish 14-1-1989 Delhi
3 Mythili 15-6-1977 Chennai
4 Bhoomi 22-9-1984 Goa
5 Sekhar 10-10-2010 Assam

 Display the student_details schema. (Hint use desc )


 Include phone_no of the students
 Update the Reg_no as

1 as SR1
2 as SR2
3 as SR3
4 as SR4
5 as SR5
(Hint Try to change INTEGER to VARCHAR2 – Use Alter command

(This modification will not be allowed as there are values in the columns, So update the column
values to null )

Step 1: Update the column values to null

UPDATE table_name
SET your_column_name = NULL;

Step 2: Now use the Alter command to change the datatype


ALTER TABLE table_name
MODIFY column_name datatype;

Step 3: Update the column values as given .

UPDATE table_name
SET column1 = value1
WHERE condition;

------------------------------------------------------------------------------------------------------------------

2. Create table

Replace Table name with your own table name.


Table name (book_name,author,price,quantity)

Book_name Author Price quantity


DBMS Sudharsan 750 4
Network Jim Kurose 300 3
Linear Algebra Gilbert Strang 500 7
Software Fred Brook 600 4
Engineering

 Increase the price of book_name Network by 1% of the current book price


 Display the details of book_name Network after updating the price.
 Display the details from the table .
 Display details from the table only if price is greater than 500.

---------------------------------------------------------------------------------------------------------------------

3. Create table

Details of customer: You can give table name

Cust_id Cust_name Addr ph_no pan_no


101 Malavika KK nagar 1010101010 PAN1234
102 Shiva Lalpet street 2345678900 BIKPA46
103 Vaidehi Krish garden 0012340043 PPD65431
104 shrenu Savitha hills 0101278633 LMV5431

 Display only the details of cust_id 101 and 102


 Display only the details of attribute Cust_id and ,Cust_name and pan_no

You might also like