Write the SQL statements to complete the following action on the Persons table.
ID: 3724102 • Letter: W
Question
Write the SQL statements to complete the following action on the Persons table. The Persons table contains two attributes FirstName and LastName.
(a) Select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"
(b) Select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jacke son"
(c) Insert a new record into the "Persons" table for Jimmy Jones
(d) deletes the record where the "FirstName" is "Peter" in the Persons Table.
Explanation / Answer
(a) Select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"
Answer:
select * from persons where firstname = 'Peter';
(b) Select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jacke son"
Answer:
select * from persons where firstname = 'Peter' and lastname='Jacke son';
(c) Insert a new record into the "Persons" table for Jimmy Jones
Answer
insert into persons values('Jimmy','Jones');
(d) deletes the record where the "FirstName" is "Peter" in the Persons Table.
Answer:
delete from persons where firstname = 'Peter';
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.