Question

In: Computer Science

QUESTION 26 For more efficient SQL, replace a series of OR clauses with IN AND NULL...

QUESTION 26

  1. For more efficient SQL, replace a series of OR clauses with

    IN

    AND

    NULL

    DISTINCT

2.5 points   

QUESTION 27

  1. SELECT ADD_MONTHS('01-FEB_2016', 3) from dual; results in

    04-FEB-2016

    01-MAY-2016

    31-MAY-2016

    04-MAY-2016

2.5 points   

QUESTION 28

  1. joining a table to itself is refered to as

    an equijoin

    a self join

    an outer join

    a non equi-join

2.5 points   

QUESTION 29

  1. SELECT MIN(NAME) from Customer; will return which of the following rows

    ALICE

    WILLIAM

    BLAKE

    JAMAL

2.5 points   

QUESTION 30

  1. To obtain all the rows from two tables regardless of matches which join should be used

    RIGHT OUTER

    LEFT OUTER

    EQUIJOIN

    FULL OUTER

2.5 points   

QUESTION 31

  1. To sort data returned from a SQL statement, which clause should be used

    ORDER BY

    WHERE

    GROUP BY

    HAVING

Its a multiple question answer.I donot have any more database

Solutions

Expert Solution

Question 26:

For more efficient SQL, replace a series of OR clauses with IN

The correct option is a) IN

Explanation:

OR can be replaced with IN considering MySQL as your RDBMS.

For e.g. given a query

Version1

SELECT * FROM table1 WHERE item_desc = 'item 1' OR item_desc = 'item 2'

can be replaced with

Version2

SELECT * FROM table1 WHERE item_desc IN ('item 1','item 2')

The queries given in Version1 and Version2 will give the same result.

Question 27:

SELECT ADD_MONTHS (01-FEB-2016’,3) FROM DUAL; results in 01-MAY-2016.

The correct option is b) 01-MAY-2016

Explanation: The function ADD_MONTHS () is used to add the required number of months to the date and result the output. The first argument of the function ADD_MONTHS () is the date and the second argument is the required number of months which should be added to the date.

Question 28:

Joining a table to itself is referred to as a self-join.

The correct option is b) self-join

Explanation: In self-join, the table is joined with itself. The table is joined with itself such that it appears that they are two tables. At least one table is temporarily renamed.

Question 29:

The given query will give that name as output which has the minimum length. Here, the length of the names is as follows:

ALICE – 5

WILLIAM-7

BLAKE – 5

JAMAL – 5

Here, the length of ALICE, BLAKE and JAMAL is the same and it is the minimum

So, the correct options will be a), c), d)

Question 30:

To obtain all the rows from two tables regardless of matches, FULL JOIN should be used.

The correct option is d) FULL OUTER

Explanation: The FULL OUTER join is the type of join which returns all the records which means all the rows from both the tables. In case the join condition is not met, for any rows on either side of the join, the columns for the other table have NULL values for that row.

Question 31:

To sort data returned from a SQL statement, ORDER BY clause should be used.

The correct option is a) ORDER BY

Explanation: The ORDER BY clause is used to sort in ascending or descending order based on single or multiple columns.


Related Solutions

The Rauzi Company is looking to replace an existing computer system with a new, more efficient...
The Rauzi Company is looking to replace an existing computer system with a new, more efficient system. They feel the new will increase cash flow. The new system will cost $435,000 today and have a 4 year production life. It will be depreciated using 100% bonus depreciation with an estimated salvage value of $175,000 at the end of its production life. The project will also set aside $15,000 for working capital. The old computer is currently two years old and...
The TP Company is looking to replace an existing machine with a new, more efficient version....
The TP Company is looking to replace an existing machine with a new, more efficient version. TP feels the new will extend the production life by one year while increasing cash flows. The new machine will cost $150,000 today and have a 6 year production life.It will be depreciated as 5-year MARCS property with an estimated salvage value of $20,000 at the end of its production life. The project will also set aside $6,000 for working capital. The old machine...
1Write an SQL statement utilizing the WHERE, LIKE, and HAVING clauses that select gender, and the...
1Write an SQL statement utilizing the WHERE, LIKE, and HAVING clauses that select gender, and the email addresses that belong to female users and have an email address that contains a number (0 to 9) within it. Create an alias for the resultant email column name and name it ‘Email Addresses Female With Numbers’ IPV4 (Internet Protocol Version 4) addresses utilize a notation known as the dotted-quad notation. Quad because an IPV4 address is actually a series of 4 numbers...
Acme Inc. may replace an old machine with a new, more efficient model. The old machine...
Acme Inc. may replace an old machine with a new, more efficient model. The old machine was purchased 5 years ago for $96,000. It is being depreciated over 8 years to zero book value using the straight-line method. Its current book value is $36,000. Its current market value is $30,000. The new machine costs $180,000. It will be depreciated over 6 years to zero book value using the straight-line method. After its useful life of 10 years it is expected...
SQL Trigger problem When attemptiing to Create or Replace a trigger I get the error "sql...
SQL Trigger problem When attemptiing to Create or Replace a trigger I get the error "sql warning trigger created with compilation errors". Trigger: CREATE OR REPLACE TRIGGER Late_Fees after UPDATE ON InventoryItem FOR EACH ROW DECLARE late_fee number; num_days number; BEGIN num_days:= to_date(:old.ReturnDate)-TO_DATE(:old.DateDue); select IntValue into late_fee from ApplicationSettings where Setting='Daily Late Fee'; :new.fee := (late_fee)*(num_days); END; / commit; Table: create table Rental( INVID int Primary key, LoanDate date, PatronID int, DueDate date, ReturnDate date, constraint PatronID_FK Foreign key (PatronID)...
X1=sample(x, size, replace = TRUE, prob = NULL), X2=sample(x, size, replace = TRUE, prob = NULL)....
X1=sample(x, size, replace = TRUE, prob = NULL), X2=sample(x, size, replace = TRUE, prob = NULL). Then run this code t.test(X1,X2) to get comparison between two groups. Question) 3. Create 4 different statistical descriptors of your data (Mean, Median, Standard Dev. and Range), Are your two groups different, or similar? Use the statistics you created in number 3 as a basis of your decision? CLASS DATA Height in inches: 62,73,69,67,66,63,60,71,67,61,62,64,62,66,68,63,64,74,64,66,74 64 68,66,61,68,62,73,73,63,61,67,73,65,67,65,69,73,64,60,70,62,63,66 64,70,70,66,72,65,63,71,69,74,65,67,74,68,73,59,67,65,70,66,74 ,64 64,69,63,68,63,69,66,65,66,62,72,71,63,60,83,69.5,65,68,68,66,59 67,65,65,65,65,68,73,74,69,65,74,66,67,62,62,73,76,65,65,63 68,63,59 ,72,71,65,66,72,64,63,68,62,64,67,64,74,70,70,66,71 69,67,67,65,63,74,66,72,65,68,62,69,62,72,70,71,64,61,75,77 71,73,72,69,67,65,70,61,67,58,62,60,61,60,72,63,72,65,73,65,66,65,69,68,67...
How to be more productive and efficient at work?
How to be more productive and efficient at work?
When are firms more efficient? Order the following firms from least efficient to most efficient. Michael...
When are firms more efficient? Order the following firms from least efficient to most efficient. Michael opens a food cart serving a type of food that is only slightly differentiate from his nearby competitors'. Kayla's cranberry bog produces one product and it sells it at market price. Comcast is the only high-speed Internet provider for a particular urban area. Javier's shoe store sells many types of shoes and operates with a lot of excess capacity.
Question: Perfectly competitive industries are believed to be more efficient than either Monopolies or Oligopolies yet...
Question: Perfectly competitive industries are believed to be more efficient than either Monopolies or Oligopolies yet there are few such industries operating within the U.S. Draft a memo addressed to your Congressman or Senator outlining the case for promoting more perfectly competitive industries and restricting the number of Monopolies and Oligopolies currently operating in the country.
Question 4 (15 marks) What is the efficient frontier and how does it change when more...
Question 4 What is the efficient frontier and how does it change when more stocks are used to construct portfolios? How does the relationship between the average return and the historical volatility of individual stocks differ from the relationship between the average return and the historical volatility of large, well-diversified portfolios? Explain what is wrong with the following argument: “If a firm issues debt that is risk free, because there is no possibility of default, the risk of the firm’s...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT