Q56. How to return multiple tables by stored procedure in sql?
Q57. What are the difference between CAST and CONVERT?
Q58. What is no sql database?
Q59. When to choose no sql database?
Q60. Full Outer join vs Cross Join in sql?
============================================================================
Q56. How to return multiple tables by stored procedure in sql?
Answer:
Simply by having multiple select statements will return multiple tables in sql.
CREATE PROCEDURE P2
AS
BEGIN
SELECT * FROM Products
SELECT * FROM Products
SELECT * FROM Categories
END
This will return 3 tables ( 2 product + 1 categories).
exec p2
============================================================================
Q57. What are the difference between CAST and CONVERT?
Answer:
SELECT CAST ('10' as int) * 20,
CONVERT (int, '10') * 20Both are used to convert data from one type to another.
CAST:
1. It is ANSI SQL specification means all sql and infact non sql database understand concept of cast.
2. No optional style parameter.
CONVERT:
1. It is MS SQL sepecific.
2. It has optional style parameter. SELECT CONVERT(VARCHAR,GETDATE(),101)
where 101 is short value representing MMDDYYYY
============================================================================
Q58. What is no sql database?
Answer:
There are mainly 4 types of noSQL database
============================================================================
Q59. When to choose no sql database?
Answer:
1. When you want to do saving in storage prices.
2. Your data is little structured or no structured.
3. You want to make use of cloud computing for storing data
4. Following ACID is not very important. Follows CAP(consistency, availability, partition tolerance)
5. Your queries are not going to have complex logic for retrieving the data.
============================================================================
Q60. Full Outer join vs Cross Join in sql?
Answer:
There is ON condition in case of crossjoin.
FULL OUTER JOIN
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;

CROSS JOIN
SELECT * FROM table1 CROSS JOIN table2;
============================================================================