CREATE PROCEDURE sps_empsearch
(
@empcode varchar(20),
@firstname varchar(50),
@lastname varchar(50)
)
AS
BEGIN TRY
if(@empcode='')
set @empcode=null
if(@firstname='')
set @firstname=null
if(@lastname='')
set @lastname=null
select emp_code,first_name,last_name,Department,designation from emp_main where first_name like isnull('%'+@firstname+'%','%') and last_name like isnull('%'+@lastname+'%','%') and Emp_code like isnull( '%'+@empcode+'%' , '%' )
END TRY
BEGIN CATCH
RAISERROR ('Retrieving Records Failed',16,1)
END CATCH
Wednesday, May 28, 2008
Simple Stored Procedures
Syntax for Stored Procedure:
Create Procedure Procedurename
(
//Parameters
)
AS
Begin
// Set of Statements
End
Create Procedure Procedurename
(
//Parameters
)
AS
Begin
// Set of Statements
End
MySQL Customer Meet on 29th May 2008 at Katriya Hotel & Towers, Hyderabad
Meet with Co-founder of MySQL, Director of Technology for MySQL and other MySQL representatives.
Location: Hyderabad
Date: Thursday, May 29, 2008
Time: 14:00-18:00 (Registration begins at 13:30)
Venue: Katriya Hotel and Towers
Email - mysqlhyderabad@sercononline.com
Topics covered:
Location: Hyderabad
Date: Thursday, May 29, 2008
Time: 14:00-18:00 (Registration begins at 13:30)
Venue: Katriya Hotel and Towers
Email - mysqlhyderabad@sercononline.com
Topics covered:
- Introduction to MySQL product line
- MySQL Enterprise Demo
- Storage Engines for MySQL
- Introduction to Understanding Replication Development Process
- MySQL Performance Tuning
- MySQL Case Studies
- Deep Technical Q&A
- Networking
Monday, May 19, 2008
Normalization
Normalization is the process of efficiently organizing data in a database. There are two goals of the normalization process: eliminating redundant data (for example, storing the same data in more than one table) and ensuring data dependencies make sense (only storing related data in a table). Both of these are worthy goals as they reduce the amount of space a database consumes and ensure that data is logically stored.
Database normalization can essentially be defined as the practice of optimizing table structures. Optimization is accomplished as a result of a thorough investigation of the various pieces of data that will be stored within the database, in particular concentrating upon how this data is interrelated. An analysis of this data and its corresponding relationships is advantageous because it can result both in a substantial improvement in the speed in which the tables are queried, and in decreasing the chance that the database integrity could be compromised due to tedious maintenance procedures.
First Normal form (1NF): A relation is said to be in 1NF if it has only single valued attributes, neither repeating nor arrays are permitted.
Second Normal Form (2NF): A relation is said to be in 2NF if it is in 1NF and every non key attribute is fully functional dependent on the primary key.
Third Normal Form (3NF): We say that a relation is in 3NF if it is in 2NF and has no transitive dependencies.
Boyce-Codd Normal Form (BCNF): A relation is said to be in BCNF if and only if every determinant in the relation is a candidate key.
Fourth Normal Form (4NF): A relation is said to be in 4NF if it is in BCNF and contains no multi valued attributes.
Fifth Normal Form (5NF): A relation is said to be in 5NF if and only if every join dependency in relation is implied by the candidate keys of relation.
Database normalization can essentially be defined as the practice of optimizing table structures. Optimization is accomplished as a result of a thorough investigation of the various pieces of data that will be stored within the database, in particular concentrating upon how this data is interrelated. An analysis of this data and its corresponding relationships is advantageous because it can result both in a substantial improvement in the speed in which the tables are queried, and in decreasing the chance that the database integrity could be compromised due to tedious maintenance procedures.
First Normal form (1NF): A relation is said to be in 1NF if it has only single valued attributes, neither repeating nor arrays are permitted.
Second Normal Form (2NF): A relation is said to be in 2NF if it is in 1NF and every non key attribute is fully functional dependent on the primary key.
Third Normal Form (3NF): We say that a relation is in 3NF if it is in 2NF and has no transitive dependencies.
Boyce-Codd Normal Form (BCNF): A relation is said to be in BCNF if and only if every determinant in the relation is a candidate key.
Fourth Normal Form (4NF): A relation is said to be in 4NF if it is in BCNF and contains no multi valued attributes.
Fifth Normal Form (5NF): A relation is said to be in 5NF if and only if every join dependency in relation is implied by the candidate keys of relation.
CRUD Matrix
SQL is consists of only 4 statements, sometimes referred to as CRUD :-
Create - INSERT - to store new data
Read - SELECT - to retrieve data
Update - UPDATE - to change or modify data.
Delete - DELETE - delete or remove data
A CRUD matrix is a table showing the Functions in an application containing SQL statement affecting parts of a database.
The CRUD Matrix is an excellent technique to identify the Tables in a Database which are used in any User interaction with a Web Site.
CRUD means ‘Create, Read, Update or Delete’, and the CRUD Matrix identifies the Tables involved in any CRUD operation.
It is very valuable to combine a CRUD Matrix with the analysis of possible User Scenarios for the Web Site.
The analysis helps to identify any Tables which are not used, and any Tables which are used heavily, and may therefore be a performance bottleneck.
Create - INSERT - to store new data
Read - SELECT - to retrieve data
Update - UPDATE - to change or modify data.
Delete - DELETE - delete or remove data
A CRUD matrix is a table showing the Functions in an application containing SQL statement affecting parts of a database.
The CRUD Matrix is an excellent technique to identify the Tables in a Database which are used in any User interaction with a Web Site.
CRUD means ‘Create, Read, Update or Delete’, and the CRUD Matrix identifies the Tables involved in any CRUD operation.
It is very valuable to combine a CRUD Matrix with the analysis of possible User Scenarios for the Web Site.
The analysis helps to identify any Tables which are not used, and any Tables which are used heavily, and may therefore be a performance bottleneck.
Replication
Replication is the process of copying/moving data between databases on the same or different servers. SQL Server supports the following types of replication scenarios:
1. Snapshot replication - It distributes data exactly as it appears at a specific moment in time and doesn’t monitor for updates. It can be used when data changes are infrequent. It is often used for browsing data such as price lists, online catalog, or data for decision support where the current data is not required and data is used as read only.
2. Merge replication - It is the process of distributing the data between publisher and subscriber, it allows the publisher and subscriber to update the data while connected or disconnected, and then merging the updates between the sites when they are connected.
3. Transactional replication (with immediate updating subscribers, with queued updating subscribers) - With this an initial snapshot of data is applied, and whenever data modifications are made at the publisher, the individual transactions are captured and propagated to the subscribers.
1. Snapshot replication - It distributes data exactly as it appears at a specific moment in time and doesn’t monitor for updates. It can be used when data changes are infrequent. It is often used for browsing data such as price lists, online catalog, or data for decision support where the current data is not required and data is used as read only.
2. Merge replication - It is the process of distributing the data between publisher and subscriber, it allows the publisher and subscriber to update the data while connected or disconnected, and then merging the updates between the sites when they are connected.
3. Transactional replication (with immediate updating subscribers, with queued updating subscribers) - With this an initial snapshot of data is applied, and whenever data modifications are made at the publisher, the individual transactions are captured and propagated to the subscribers.
Wednesday, May 14, 2008
PHP tutorials
Hi,
You can find php tutorials from http://in2.php.net/tut.php
and it is very useful for the beginners.
Techno Zone
You can find php tutorials from http://in2.php.net/tut.php
and it is very useful for the beginners.
Techno Zone
Intro to SQL
SQL is short for Structured Query Language and is a widely used database language, providing means of data manipulation (store, retrieve, update, delete) and database creation.
The SQL SELECT clause selects data from one or more database tables and/or views. In its basic form the SQL SELECT syntax looks like this:
SELECT ColumnName1, ColumnName2, …FROM Table1
Ex:
"SELECT fname from Employee"
If we want to select all the data (all columns) from the Employee
"SELECT *FROM Employee"
The SQL INSERT INTO clause facilitates the process of inserting data into a SQL table.
Ex: "INSERT INTO Weather (City, Date)VALUES (Delhi '05/10/2005') "
SQL WHERE clause works in conjunction with other SQL clauses like SELECT, INSERT and UPDATE to specify a search condition for these statements.
Ex: "SELECT * FROM Employee Where City = 'New Delhi' "
SQL DISTINCT command used along with the SELECT keyword retrieves only unique data entries depending on the column list you have specified after it.
Ex: "SELECT DISTINCT CityFROM Users "
SQL UPDATE clause serves to update data in database table. The Syntax is
"UPDATE Table1SET Column1 = Value1, Column2 = Value2, … "
SQL DELETE clause is used to delete data from a database table. The basic Syntax is
"DELETE FROM Table1"
SQL TRUNCATE TABLE clause deletes all rows from a database table. Syntax is
"TRUNCATE TABLE tablename"
SQL ORDER BY clause defines in what order to return a data set retrieved with a SQL SELECT statement.
"SELECT * FROM employee ORDER BY City "
The SQL GROUP BY clause is used along with the SQL aggregate functions and specifies the groups where selected rows are placed. WHEN one or more aggregate functions are presented in the SQL SELECT column list, the SQL GROUP BY clause calculates a summary value for each group.
The SQL SELECT clause selects data from one or more database tables and/or views. In its basic form the SQL SELECT syntax looks like this:
SELECT ColumnName1, ColumnName2, …FROM Table1
Ex:
"SELECT fname from Employee"
If we want to select all the data (all columns) from the Employee
"SELECT *FROM Employee"
The SQL INSERT INTO clause facilitates the process of inserting data into a SQL table.
Ex: "INSERT INTO Weather (City, Date)VALUES (Delhi '05/10/2005') "
SQL WHERE clause works in conjunction with other SQL clauses like SELECT, INSERT and UPDATE to specify a search condition for these statements.
Ex: "SELECT * FROM Employee Where City = 'New Delhi' "
SQL DISTINCT command used along with the SELECT keyword retrieves only unique data entries depending on the column list you have specified after it.
Ex: "SELECT DISTINCT CityFROM Users "
SQL UPDATE clause serves to update data in database table. The Syntax is
"UPDATE Table1SET Column1 = Value1, Column2 = Value2, … "
SQL DELETE clause is used to delete data from a database table. The basic Syntax is
"DELETE FROM Table1"
SQL TRUNCATE TABLE clause deletes all rows from a database table. Syntax is
"TRUNCATE TABLE tablename"
SQL ORDER BY clause defines in what order to return a data set retrieved with a SQL SELECT statement.
"SELECT * FROM employee ORDER BY City "
The SQL GROUP BY clause is used along with the SQL aggregate functions and specifies the groups where selected rows are placed. WHEN one or more aggregate functions are presented in the SQL SELECT column list, the SQL GROUP BY clause calculates a summary value for each group.
Welcome to Techno Zone
Hi Friends
Welcome to Techno Zone
This is a place where you can discuss about the .Net, SQL Server, PHP,MySQL and Web Designing technologies.
You can post your doubts, share the latest trends in the related technologies and make this blog a One Stop forum for all our Friends.
Techno Zone
Welcome to Techno Zone
This is a place where you can discuss about the .Net, SQL Server, PHP,MySQL and Web Designing technologies.
You can post your doubts, share the latest trends in the related technologies and make this blog a One Stop forum for all our Friends.
Techno Zone
Subscribe to:
Posts (Atom)