Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
36 views

Answers in Fundamentals

The document discusses various SQL concepts like conditional statements, joins, aggregate functions and more. It provides examples of how to use keywords like AND, OR, BETWEEN, LIKE, LIMIT, HAVING, MAX, MIN and conditional statements in SQL queries. It also asks questions about joins, limiting results and examples of SQL queries.

Uploaded by

CATHLYN DIMAYUGA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Answers in Fundamentals

The document discusses various SQL concepts like conditional statements, joins, aggregate functions and more. It provides examples of how to use keywords like AND, OR, BETWEEN, LIKE, LIMIT, HAVING, MAX, MIN and conditional statements in SQL queries. It also asks questions about joins, limiting results and examples of SQL queries.

Uploaded by

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

ANSWERS IN FUNDAMENTALS

1. In SQL statement, differentiate “AND” and “OR” behavior when filtering the result
of the query.
- The “AND” operator always used the WHERE clause they used this to select rows and
the conditions will be both true. The “OR” operator is also used the WHERE clause but
they used this to include the rows in the result of the case either the condition is true.
This two operator is the same but when they use the WHERE clause they are different.

2. How important is conditional statement on SQL query? Imagine that a conditional


statement is not present, what would be the possible behavior of the SQL query?
-

3. How do ” between ” keywords behave on SQL queries?


- To filter the result set within a certain range. This keyword selects values within a given
range.

4. What could be the benefits of using “Limit” on the query?


- The benefits of using “Limit” on the query is to limit the records in the table based on
the limit value. And also it allows you to set the maximum numbers of rows in the result
set.

5. How does the “like” condition work? What are the different ways to use like? What
is the symbol we use to derive this condition?
- The “like” condition work when it used the WHERE clause to search for a specific
pattern in the column. The Wildcard % is used to search for a pattern to get data in the
specified patterns.

6. Explain the usage of “Having” keyword. L;


- The usage of “Having” keyword is to aggregate functions.

7. What are the possible usage of MAX and MIN in the system?
- The usage of the MAX is to enables you to find the highest value in the column while
the usage of the MIN is to enables you to find the lowest value in the column.

8. What would be the output if we use MAX and MIN on a non numeric data type?
- I think if we use MAX and MIN on a non numeric data type is, the output will not be
working because a non numeric data type is not a value. And the usage of this two is to
find values in the column.

9. Conditional statements on the server side may have benefits on the entire system.
Instead of placing the condition inside the “backend” code, we are leaning on
placing it on the server side. Why?
-

10. How many conditions can we add on one SQL query?


- I think two or three conditions can be added in one SQL query.

11. How are we going to limit result data on SQL query using SQL server.
-

JOINS

1. Explain the differences between inner join and outer join.


- The differences between inner join and outer join is, inner join is combine rows from
the different tables if the join condition is true. While the outer join is combine rows
from the different tables even if the join condition is not met.

2. Explain the difference between right and left join.


- The have no lot of differences, but the difference they have is when it comes in the
matching record of the tables either left or right table.

3. How does a full join works?


- Full join works when it combines the result of right join and left join.

4. How many joins can be use in one SQL statement? 


-

5. Can we combine each different type of joins in a single SQL statement? Explain
your answer.
-

6. Give an example where we can use all the types of joins individually.
-
REQUIRED OUTPUT
1. Create a SQL query that will return all Transaction history that was done between January
2015 and  December 2015.
-
2. Create a SQL query that will delete all records from product logs with ID less than 100 and
transaction type is equals to 0.
-
3. Create a SQL query that will update all records in Supplier Details table that starts with
“Sup” and ends with “S”
-
4. Update the structure of the table “ProductRecord” add another column and name it
CurrentStockQuantity, this is numeric and default value is  0.
-

5. Do a query that will show the user the product with the highest quantity.
-
6. Do a query that will show the user the product with the lowest quantity.
-
7. Do a query that will show the user the product with quantity less than 5. 
-
8. Do a query that will give an output of all Invoices with due date on December 2015. In
addition to that, ProductName and SKU must be included in the result.
-
9. Create another query similar to No 8, but this time if there’s no Invoice Available,
ProductDetails will still be visible as a result. Invoice Fields should display NULL as values.
-

You might also like