What is Procedure?
Description:
A stored
procedure is a group of sql statements that has been created and stored in the
database. Stored procedure will accept input parameters so that a single
procedure can be used over the network by several clients using different input
data. Stored procedure will reduce network traffic and increase the
performance. If we modify stored procedure all the clients will get the updated
stored procedure
- System Stored Procedures
- User Defined Stored procedures
- Extended Stored Procedures
System Stored Procedures:
System stored procedures are stored in
the master database and these are starts with a sp_ prefix. These procedures can be used to perform variety of
tasks to support sql server functions for external application calls in the
system tables
Ex: sp_helptext [StoredProcedure_Name]
User Defined Stored Procedures:
User Defined
stored procedures are usually stored in a user database and are typically
designed to complete the tasks in the user database. While coding these
procedures don’t use sp_ prefix because if we use the sp_ prefix
first it will check master database then it comes to user defined databas
What is Function:
Function is a database object in Sql
Server. Basically it is a set of sql statements that accepts only input
parameters, perform actions and return the result. Function can return only
single value or a table. We can’t use function to Insert, Update, Delete
records in the database table(s). For more about stored procedure and function
refer the article Difference between Stored Procedure and
Function
Need to prepare the Cookies
Need to prepare the V model(Basic Testing
Qustions)
Need to prepare SQL queries once(eliminate Duplicate Records)
Select st.name,s.name from sys.tables st
join sys.columns on ST.object_id=sc.object_id and sc.name like ‘%Patient_id%’
What Is Difference Between Procedure and
Functions:
- Procedure can return zero or n values whereas function can return one value which is mandatory.
- Procedures can have input/output parameters for it whereas functions can have only input parameters.
- Procedure allows select as well as DML statement in it whereas function allows only select statement in it.
- Functions can be called from procedure whereas procedures cannot be called from function.
- Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.
- We can go for transaction management in procedure whereas we can't go in function.
- Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.
- UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
- UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
- Inline UDF's can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
DDL Data Definition Language (DDL) statements are
used to define the database structure or schema. Some examples:
- CREATE - to create objects in the database
- ALTER - alters the structure of the database
- DROP - delete objects from the database
- TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
- COMMENT - add comments to the data dictionary
- RENAME - rename an object
DML Data Manipulation Language (DML) statements
are used for managing data within schema objects. Some examples:
- SELECT - retrieve data from the a database
- INSERT - insert data into a table
- UPDATE - updates existing data within a table
- DELETE - deletes all records from a table, the space for the records remain
- MERGE - UPSERT operation (insert or update)
- CALL - call a PL/SQL or Java subprogram
- EXPLAIN PLAN - explain access path to data
- LOCK TABLE - control concurrency
DCL Data Control Language (DCL) statements. Some
examples:
- GRANT - gives user's access privileges to database
- REVOKE - withdraw access privileges given with the GRANT command
TCL
Transaction
Control (TCL) statements are used to manage the changes made by DML statements.
It allows statements to be grouped together into logical transactions.
- COMMIT - save work done
- SAVEPOINT - identify a point in a transaction to which you can later roll back
- ROLLBACK - restore database to original since the last COMMIT
- SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use
What is VIEW:
Views are virtual tables that are compiled at run time. The data
associated with views are not physically stored in the view, but it is stored
in the base tables of the view. A view can be made over one or more database
tables. Generally we put those columns in view that we need to retrieve/query
again and again. Once you have created the view, you can query view like as
table. We can make index, trigger on view.
In
Sql Server we make views for security purpose since it restricts the user to
view some columns/fields of the table(s). Views show only those columns that
are present in the query which is used to make view.One more advantage of Views
is, data abstraction since the end user is not aware of all the data present in
database tableWhat is Traceability Matrix
In Simple words -
A requirements traceability matrix is a document that traces and maps user
requirements [requirement Ids from requirement specification document] with the
test case ids. Purpose is to make sure that all the requirements are covered in
test cases so that while testing no functionality can be missed.
What are the fields used in
Traceability matrix:
ID, Assoc ID,
Technical Assumption(s) and/or Customer Need(s), Functional Requirement,
Status, Architectural/Design Document, Technical Specification, System
Component(s), Software Module(s), Test Case Number, Tested In, Implemented In,
Verification, Additional Comments,
No comments:
Post a Comment