Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is wrong with this T-SQL statement? Select * from dbo.book where * in (\'tw

ID: 3855278 • Letter: W

Question

What is wrong with this T-SQL statement?

Select * from dbo.book where * in ('two towers','hello kitty');

The book titles are not in double quotes.

You must use a column before the in keyword in, not a *

You can't have 2 values in a where in clause

The values should be separated by a semicolon, not a comma

10 points   

Question 2

When you write a query joining 2 tables, you can choose from several different types of joins. When you use the keyword join by itself, it is equivalent to another type of join. Select the statement that is equal to this statement.


Select * from tableName1
join tableName2
on tableName1.col1 = tableName2.col4;

Select * from tableName1
inner join tableName2
on tableName1.col1 = tableName2.col4;

Select * from tableName1
outer join tableName2
on tableName1.col1 = tableName2.col4;

Select * from tableName1
right join tableName2
on tableName1.col1 = tableName2.col4;

Select * from tableName1
left join tableName2
on tableName1.col1 = tableName2.col4;

10 points   

Question 3

Database inserts are important to add data to the database. Select the insert that is correct based on the following database table create statement.


create table person(id bigint, first_name varchar(100), last_name varchar(100), street_address varchar(200), city varchar(100), state varchar(50), zip int);

insert into person(id bigint, first_name varchar(100), last_name varchar(100), street_address varchar(200), city varchar(100), state varchar(50), zip int)values(1,'Billy','Meyers','1001 Charleston','Cincinnati','OHIO',451001);

insert into person(id, first_name, last_name, street_address, city, state, zip)
values(1,'Billy','Meyers','1001 Charleston','Cincinnati','OHIO',451001);

insert into person(id, first_name, last_name, street_address, city, state, zip)
values(1,Billy,Meyers,1001 Charleston,Cincinnati,OHIO,451001);

insert into person(id, first_name, last_name, street_address, city, state, zip)
values(1,[Billy],[Meyers],[1001 Charleston],[Cincinnati],[OHIO],451001);

10 points   

Question 4

A where clause is used to limit the number of rows returned in a result set.

True

False

10 points   

Question 5

We are going to try to find Jackie Joyner-Kersee via a LastName column. You know the name ends with Kersee and the surname is hyphenated. Select the where clause that will search all of the customer rows looking for anything prefixing -Kersee.

WHERE CustomerLastName LIKE '%-Kersee'

WHERE CustomerLastName LIKE '_-Kersee'

WHERE CustomerLastName LIKE '*-Kersee'

WHERE CustomerLastName = '%-Kersee'

10 points   

Question 6

When you are querying data from a database table(s), you often want to sort the data by one or more columns. Choose the clause you will use in a select statement to order the results by one or more columns.

group by

order

order by

group

10 points   

Question 7

Choose the statement that will find the records in the customer table that have a value in the first_name column.

select * from customer where first_name is null;

select * from customer where first_name <> null;

select * from customer where first_name like '%not null';

select * from customer where first_name is not null;

10 points   

Question 8

If I have the following join statement, logically I want to get what kind of results?

select * from customer
outer join account on
customer.id = account.person;

The customers that don't have an account and the accounts that don't have a customer

The customers that have an account

The accounts that don't have a customer

The customers that don't have an account

10 points   

Question 9

This update statement is written correctly.


update customer set first_name = 'Rebekah' where first_name = 'rebekah';

True

False

10 points   

Question 10

This delete statement is written correctly.


delete from customer;

True

False

NEED HELP ASAP PLS

The book titles are not in double quotes.

You must use a column before the in keyword in, not a *

You can't have 2 values in a where in clause

The values should be separated by a semicolon, not a comma

Explanation / Answer

Question 1

What is wrong with this T-SQL statement?

Select * from dbo.book where * in ('two towers','hello kitty');

Ans) You must use a column before the in keyword in, not a *

Reason:

Syntax:

Select columnname(s)

From tablename

Where columname IN (value1,value2….);

___________________________

Question 2

When you write a query joining 2 tables, you can choose from several different types of joins. When you use the keyword join by itself, it is equivalent to another type of join. Select the statement that is equal to this statement.


Select * from tableName1
join tableName2
on tableName1.col1 = tableName2.col4;

Ans)

Select * from tableName1
inner join tableName2
on tableName1.col1 = tableName2.col4;

___________________________

Question 3

Database inserts are important to add data to the database. Select the insert that is correct based on the following database table create statement.


create table person(id bigint, first_name varchar(100), last_name varchar(100), street_address varchar(200), city varchar(100), state varchar(50), zip int);

Ans)

insert into person(id, first_name, last_name, street_address, city, state, zip)
values(1,'Billy','Meyers','1001 Charleston','Cincinnati','OHIO',451001);

Reason: we no need to provide single quotes for numbers but its mandatory for alphanumeric types .

___________________________

Question 4

A where clause is used to limit the number of rows returned in a result set.

Ans)

True

___________________________

Question 5

We are going to try to find Jackie Joyner-Kersee via a LastName column. You know the name ends with Kersee and the surname is hyphenated. Select the where clause that will search all of the customer rows looking for anything prefixing -Kersee.

Ans)

WHERE CustomerLastName LIKE '%-Kersee'

___________________________

Question 6

When you are querying data from a database table(s), you often want to sort the data by one or more columns. Choose the clause you will use in a select statement to order the results by one or more columns.

Ans)

order by

Reason: by default the order by keyword is used to sort the data in ascending order.But to sort the data in decending order we have to specify the keyword DESC.

___________________________

Question 7

Choose the statement that will find the records in the customer table that have a value in the first_name column.

Ans)

select * from customer where first_name is not null;

___________________________

Question 8

If I have the following join statement, logically I want to get what kind of results?

select * from customer
outer join account on
customer.id = account.person;

Ans) The customers that have an account

___________________________

Question 9

This update statement is written correctly.


update customer set first_name = 'Rebekah' where first_name = 'rebekah';

Ans) True

___________________________

Question 10

This delete statement is written correctly.

Ans)true

Reason: As we didn’t provide where clause in the delete statement ,all rows will get deleted.If we provide where clause only the selected rows will be deleted.

___________________________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote