Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. INSERT 2. UPDATE 3. DELETE INSERT INTO: This is used to add records into a relation. These are four type of INSERT INTO queries

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. INSERT 2. UPDATE 3. DELETE INSERT INTO: This is used to add records into a relation. These are four type of INSERT INTO queries which are as a) Inserting a single record Syntax: INSERT INTO (field_1, field 2...... field 0 )VALUES (data_1,data_2, data 0 ); Example: SQL> INSERT INTO student (sno, sname, class, address)VALUES (1, 'Ravi', 'M. Tech', 'Palakol'); SQL> INSEWT INTO student (sno, sname, class, address) VALUES (2, 'John' , 'B.Tech', 'Abu Dhabi'); b) Inserting a single record Syntax: INSERT INTO VALUES (data_1,data_2, data d ); Example: SQL> INSERT INTO student VALUES (1, ' Ravi ', 'M. Tech', 'Palakol' '); 2. UPDATE-SET-WHERE: This is used to update the content of a record in a relation. Syntax: UPDATE relation name SET Field_name1=data,field_name2=data, WHERE field _name=data; Example: SQL> UPDATE student SET sname = 'kumar.' WHERE sno=1; 3. DELETE-FROM: This is used to delete all the records of a relation but it will retain the structure of that relation. a) DELETE-FROM-WHERE: This is used to delete a selected record from a relation. Syntax: DELETE FROM relation. ,ame WHERE condition; Example: SQL> DELETE FROM student WHERE sno =2; b) DELETE-FROM: This is used to delete all the records of relation. Syntax: DELETE FROM relation. name; Example: SQL> DELETE FROM student; 4. TRUNCATE: This command will remove the data permanently. But structure will not be removed. Difference between Truncate \& Delete: - By using truncate command data will be removed permanently \& will not get back where as by using delete command data will be removed temporally \& get back by using roll back command. - By using delete command data will be removed based on the condition where as by using truncate command there is no condition. - Truncate is a DDL command \& delete is a DML command. Syntax: TRUNCATE Table > Example: SQL> TRUNCATE TABLE student; - Io Retrieve dafa from one or more tables. Firstly, do to some select queries let us create a table called 'department' with the following records: DEPTNO NUMBER(5) DNAME VARCHAR(22) LOCATION VARCHAR(30) Secondly, insert the following data into the 'department' table using insert Query: 1. SELECT FROM: To display all fields for all records. Syntax: SELECT * FROM relation_name: Example: SQL> select * from department; 2. SELECT FROM: To display a set of fields for all records of relation. Syntax: SELECT a set of fields FROM relation_name; Example: SQL> select deptno, dname from department; \begin{tabular}{|ll} \hline Output: & \\ DEPTNO & DNAME \\ ... & . \\ 10 & ACCOUNTING \\ 20 & RESEARCH \\ 30 & SALES \\ \hline \end{tabular} 3. SELECT - FROM -WHERE: This query is used to display a selected set of fields for a selected set of records of a relation. Syntax: SELECT a set of fields FROM relation. name. WHERE condition;Not the question youre looking for?Post any question and get expert help quickly.Start learning Chegg Products & ServicesChegg Study HelpCitation GeneratorDigital Access CodesGrammar CheckerMath SolverMobile AppsSolutions ManualPlagiarism CheckerChegg PerksCompanyCompanyAbout CheggChegg For GoodCollege MarketingInvestor RelationsJobsJoin Our Affiliate ProgramMedia CenterChegg NetworkChegg NetworkBusuuCitation MachineEasyBibMathwayThinkfulCustomer ServiceCustomer ServiceGive Us FeedbackCustomer ServiceManage SubscriptionEducatorsEducatorsAcademic IntegrityHonor ShieldInstitute of Digital Learning 2003-2024 Chegg Inc. All rights reserved.Cookie NoticeYour Privacy ChoicesDo Not Sell My InfoGeneral PoliciesPrivacy PolicyHonor CodeIP Rights

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions