Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
15 views1 page

A

The document outlines key differences between various database concepts, including Stored Procedures vs. Functions, DELETE vs. TRUNCATE commands, WHERE vs. HAVING clauses, Primary Key vs. Unique Key, and Local vs. Global Temporary Tables. It highlights the specific characteristics and usage scenarios for each concept, such as parameter types, DML usage, and key constraints. Additionally, it introduces the types of keys in databases, including super, primary, candidate, and foreign keys.

Uploaded by

postbox181
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

A

The document outlines key differences between various database concepts, including Stored Procedures vs. Functions, DELETE vs. TRUNCATE commands, WHERE vs. HAVING clauses, Primary Key vs. Unique Key, and Local vs. Global Temporary Tables. It highlights the specific characteristics and usage scenarios for each concept, such as parameter types, DML usage, and key constraints. Additionally, it introduces the types of keys in databases, including super, primary, candidate, and foreign keys.

Uploaded by

postbox181
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1. What is the difference between “Stored Procedure” and “Function”?

1. A procedure can have both input and output parameters, but a function
can only have input parameters.
2. Inside a procedure we can use DML (INSERT/UPDATE/DELETE)
statements. But inside a function we can't use DML statements.
3. We can't utilize a Stored Procedure in a Select statement. But we can use a
function in a Select statement.
2. What is the difference between the “DELETE” and “TRUNCATE” commands?
1. The DELETE command is used to remove rows from a table based on a
WHERE condition whereas TRUNCATE removes all rows from a table.
2. So we can use a where clause with DELETE to filter and delete specific
records whereas we cannot use a Where clause with TRUNCATE.

3. What is the difference between the “WHERE” clause and the “HAVING” clause?
1. WHERE clause can be used with a Select, Update and Delete Statement
Clause but the HAVING clause can be used only with a Select statement.
2. We can't use an aggregate functions in the WHERE clause unless it is in a
sub-query contained in a HAVING clause whereas we can use an aggregate
function in the HAVING clause. We can use a column name in the HAVING
clause but the column must be contained in the group by clause.
4. What is the difference between “Primary Key” and “Unique Key”?

1. We can have only one Primary Key in a table whereas we can have more
than one Unique Key in a table.
2. The Primary Key cannot have a NULL value whereas a Unique Key may
have only one null value.
3. A Primary Key supports an Auto Increment value whereas a Unique Key
doesn't support an Auto Increment value.
5. What is the difference between a “Local Temporary Table” and “Global
Temporary Table”?
1. A Local Temporary Table is created by giving it a prefix of # whereas
a Global Temporary Table is created by giving it a prefix of ##.
2. A Local Temporary Table cannot be shared among multiple users whereas
a Global Temporary Table can be shared among multiple users.
6. What are super, primary, candidate and foreign keys?

You might also like