Answers in Fundamentals
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.
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.
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?
-
11. How are we going to limit result data on SQL query using SQL server.
-
JOINS
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.
-