Hi Friends
Today I will be discussing some more Q&A on SQL Server.
Q. What is De-normalization?
Ans.For optimizing the performance of a database by adding redundant data or by grouping data is called de-normalization. It is sometimes necessary because current DBMS implement the relational model poorly.
In some cases, de-normalization helps cover up the inefficiencies inherent in relational database software. A relational normalized database imposes a heavy access load over physical storage of data even if it is well tuned for high performance.
A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.
Q. What are the properties of the Relational tables?
Ans. Relational tables have six properties
Values Are Atomic
Columns in a relational table are not repeating group or arrays. Such tables are referred to as being in the "first normal form" (1NF). The atomic value property of relational tables is important because it is one of the cornerstones of the relational model. The key benefit of the one value property is that it simplifies data manipulation logic.
Column Values Are of the Same Kind
All values in a column come from the same set of values or domain. For example, a Product_Price column contains only specific to product price. It never contains other information such as comments, status flags, or even weekly salary.
It simplifies data access because developers and users can be certain of the type of data contained in a given column. It also simplifies data validation. Since all values are from the same domain, the domain can be defined and enforced with the Data Definition Language (DDL) of the database software.
Each Row is Unique
Each unique row ensures that no two rows in a relational table are identical; there is at least one column, or set of columns, the values of which uniquely identify each row in the table. Such columns are called primary keys.This property guarantees that every row in a relational table is meaningful and that a specific row can be identified by specifying the primary key value.
The Sequence of Columns is Insignificant
Ordering of the columns in the relational table has no meaning. Columns can be retrieved in any order and in various sequences. The benefit of this property
is that it enables many users to share the same table without concern of how the table is organized. It also permits the physical structure of the database to change without affecting the relational tables.
The Sequence of Rows is Insignificant
This property is analogous the one above but applies to rows instead of columns. The main benefit is that the rows of a relational table can be retrieved in different order and sequences. Adding information to a relational table is simplified and does not affect existing queries.
Each Column Has a Unique Name
Because the sequence of columns is insignificant, columns must be referenced by name and not by position. In general, a column name need not be unique within an entire database but only within the table to which it belongs.
Q.What is lock escalation?
Ans. Lock escalation is the process of converting a lot of low level locks (like row locks, page locks) into higher level locks (like table locks). Every lock is a memory structure; too many locks would mean, more memory being occupied by locks. To prevent this from happening, SQL Server escalates the many fine-grain locks to fewer coarse-grain locks. Lock escalation threshold was definable in SQL Server 6.5, but from SQL Server 7.0 onwards it's dynamically managed by SQL Server.
Q. What is the difference between clustered and a non-clustered index?
Ans. A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.
Q. What’s the difference between a primary key and a unique key?
Ans. Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.
I will covering some more important Q&A in my coming interactions.
Happy Learning!!...
Cheers
Padhaku Einstein
Contact me at einstein.padhaku@gmail.com
Thursday, November 20, 2008
Wednesday, November 19, 2008
If you have a Spark, make it DreamSpark
Microsoft Corporation is actively engaged in the Education space with a committed vision to empower the learning and teaching community worldwide with 21st century skills. While there are several innovative programs for the Student, Teacher and Institution community worldwide, Microsoft India is keen to extend those innovative programs for the Learning Community in India too.
DreamSpark is a new initiative designed for the Global Student Community with a view to empowering & enabling them with leading technology tools & to enhance their employability skills by providing them software design and development tools at no charge. The DreamSpark program was announced by Bill Gates on February 19, 2008 at Stanford University and it is estimated that in excess of 100 million students will be able to access these software titles "at no charge" through this program.
With DreamSpark, you can get access to various Microsoft Software including:
-Visual Studio 2005/2008 Professional Edition
With DreamSpark, you can get access to various Microsoft Software including:
-Visual Studio 2005/2008 Professional Edition
-Expression Studio, including
Expression Web
Expression Blend
Expression Design
Expression Media
-SQL Server 2005 Express
-SQL Server 2005 Developer Edition
-Windows Standard Server, XNA Game Studio 2.0 (with 12-month trial academic subscription to the XNA Creators Club)
As Microsoft's Best Training Partner, NIIT is glad to bring these software to your doorsteps in the most convenient way. So, visit your nearest NIIT centre in a metro city and collect your DVD.
For more details contact 1800 102 6448 (Toll Free Number)
Happy Sparking....
Cheers!!...
NIIT Edgeineers
contact us at niitedgeineers@gmail.com
Wednesday, November 12, 2008
MS-SQL Server
Hi Friends
Today I will be discussing Q&A on SQL Server.
Q. Difference between "VARCHAR" and "VARCHAR2" datatypes?
Ans. The VARCHAR datatype is actually a subtype of VARCHAR2. Currently the two datatypes are identical, and you're free to use either. However, if you use VARCHAR and the ANSI standard changes, the database will be forced to change the VARCHAR type to conform, and you'll have to change any apps that depend on it. If we declare datatype as VARCHAR then it will occupy space for NULL values, In case of VARCHAR2 datatype it will not occupy any space.
Q. How do you optimize stored procedures in SQL Server?
Ans.
- Use as much as possible WHERE clause filters. Where Clause is the most important part for optimization.
- Select only those fields which really require.
- Joins are expensive in terms of time. Make sure that use all the keys that relate the two tables together and don't join to unused tables, always try to join on indexed fields. The join type is important as well (INNER, OUTER).
Q. What is a View in SQL Server Database?
Ans. As per the theory of database (which includes SQL Server, Oracle) a view can be thought of stored SQL query which result can be accessible as a table. It can be used for retrieving data, as well as updating or deleting rows. But database view does not have physical schema. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.
Q. What is a Linked Server?
Ans. A linked server configuration enables SQL Server to execute commands against OLE DB data sources on remote servers. Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.
Linked servers offer the following advantages:
- Remote server access.
- The ability to issue distributed queries, updates, commands, and transactions on heterogeneous data sources across the enterprise.
- The ability to address diverse data sources similarly.
With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data.
Q. What is a "trigger" in SQL Server?
Ans. In any database including SQL Server a trigger is a procedure that initiates on INSERT, DELETE or UPDATE actions. Before SQL Server 2000 Triggers are also used to maintain the referential integrity. We can not execute triggers explicitly; the DBMS automatically fires the trigger when data modification events (INSERT, DELETE or UPDATE) happened in the associated table.Triggers are same as stored procedures in term of procedural logic that is stored at the database level. Stored procedures are executed explicitly and triggers are event-driven. Triggers can also execute stored procedures.
Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.
Today I will be discussing Q&A on SQL Server.
Q. Difference between "VARCHAR" and "VARCHAR2" datatypes?
Ans. The VARCHAR datatype is actually a subtype of VARCHAR2. Currently the two datatypes are identical, and you're free to use either. However, if you use VARCHAR and the ANSI standard changes, the database will be forced to change the VARCHAR type to conform, and you'll have to change any apps that depend on it. If we declare datatype as VARCHAR then it will occupy space for NULL values, In case of VARCHAR2 datatype it will not occupy any space.
Q. How do you optimize stored procedures in SQL Server?
Ans.
- Use as much as possible WHERE clause filters. Where Clause is the most important part for optimization.
- Select only those fields which really require.
- Joins are expensive in terms of time. Make sure that use all the keys that relate the two tables together and don't join to unused tables, always try to join on indexed fields. The join type is important as well (INNER, OUTER).
Q. What is a View in SQL Server Database?
Ans. As per the theory of database (which includes SQL Server, Oracle) a view can be thought of stored SQL query which result can be accessible as a table. It can be used for retrieving data, as well as updating or deleting rows. But database view does not have physical schema. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.
Q. What is a Linked Server?
Ans. A linked server configuration enables SQL Server to execute commands against OLE DB data sources on remote servers. Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.
Linked servers offer the following advantages:
- Remote server access.
- The ability to issue distributed queries, updates, commands, and transactions on heterogeneous data sources across the enterprise.
- The ability to address diverse data sources similarly.
With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data.
Q. What is a "trigger" in SQL Server?
Ans. In any database including SQL Server a trigger is a procedure that initiates on INSERT, DELETE or UPDATE actions. Before SQL Server 2000 Triggers are also used to maintain the referential integrity. We can not execute triggers explicitly; the DBMS automatically fires the trigger when data modification events (INSERT, DELETE or UPDATE) happened in the associated table.Triggers are same as stored procedures in term of procedural logic that is stored at the database level. Stored procedures are executed explicitly and triggers are event-driven. Triggers can also execute stored procedures.
Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.
I will covering some more important Q&A on SQL Server in my coming interactions.
Happy Learning!!...
Cheers
Padhaku Einstein
Contact me at einstein.padhaku@gmail.com
Thursday, November 6, 2008
Why one should do SQL Server 2008?
Hi friends,
One of our community member Sushil who has done SQL Server 2005 from NIIT has asked that should he need to do SQL Server 2008 also? I think some of you are also having this question so sharing it here.
Dear Sushil, though the fundamentals of the technology remains the same but if you have to get the best of the that you have to keep yourself upgraded with the changing technology. SQL Server 2008 provides a trusted, productive, and intelligent enterprise data platform. I am writing some of the features of SQL Server 2008, which makes it very special Database .
Enhanced Database Mirroring
SQL Server 2008 builds on SQL Server 2005 by providing a more reliable platform that has enhanced database mirroring, including automatic page repair, improved performance, and enhanced supportability.
Log Stream Compression
Database mirroring requires data transmissions between the participants of the mirroring implementations. With SQL Server 2008, compression of the outgoing log stream between the participants delivers optimal performance and minimizes the network bandwidth used by database mirroring.
Automatic Recovery of Data Pages
SQL Server 2008 enables the principal and mirror machines to transparently recover from 823/824 types of data page errors by requesting a fresh copy of the suspect page from the mirroring partner transparently to end users and applications.
Transparent Data Encryption
Enable encryption of an entire database, data files, or log files, without the need for application changes. Benefits of this include: Search encrypted data using both range and fuzzy searches, search secure data from unauthorized users, and data encryption without any required changes in existing applications.
Performance Data Collection
Performance tuning and troubleshooting are time-consuming tasks for the administrator. To provide actionable performance insights to administrators, SQL Server 2008 includes more extensive performance data collection, a new centralized data repository for storing performance data, and new tools for reporting and monitoring.
Language Integrated Query (LINQ)
Enable developers to issue queries against data, using a managed programming language, such as C# or VB.NET, instead of SQL statements. Enable seamless, strongly typed, set-oriented queries written in .NET languages to run against ADO.NET (LINQ to SQL), ADO.NET DataSets (LINQ to DataSets), the ADO.NET Entity Framework (LINQ to Entities), and to the Entity Data Service Mapping provider. Use the new LINQ to SQL provider that enables developers to use LINQ directly on SQL Server 2008 tables and columns.
ADO.NET Data Services
The Object Services layer of ADO.NET enables the materialization, change tracking, and persistence of data as CLR objects. Developers using the ADO.NET framework can program against a database, using CLR objects that are managed by ADO.NET. SQL Server 2008 introduces more efficient, optimized support that improves performance and simplifies development.
Partitioned Table Parallelism
Partitions enable organizations to manage large growing tables more effectively by transparently breaking them into manageable blocks of data. SQL Server 2008 builds on the advances of partitioning in SQL Server 2005 by improving the performance on large partitioned tables.
There are many other exciting features of SQL Server 2008. If you want to know more about SQL Server 2008you can visit to the nearest NIIT Centre and ask for SQL Server 2008 program under New Technology Skill Enhancement series.
"Remember Data is not just Data anymore, it's a new form of Energy".
So keep upgrading yourself in latest technologies.
Happy Learning!!...
Cheers
Madhu S
One of our community member Sushil who has done SQL Server 2005 from NIIT has asked that should he need to do SQL Server 2008 also? I think some of you are also having this question so sharing it here.
Dear Sushil, though the fundamentals of the technology remains the same but if you have to get the best of the that you have to keep yourself upgraded with the changing technology. SQL Server 2008 provides a trusted, productive, and intelligent enterprise data platform. I am writing some of the features of SQL Server 2008, which makes it very special Database .
Enhanced Database Mirroring
SQL Server 2008 builds on SQL Server 2005 by providing a more reliable platform that has enhanced database mirroring, including automatic page repair, improved performance, and enhanced supportability.
Log Stream Compression
Database mirroring requires data transmissions between the participants of the mirroring implementations. With SQL Server 2008, compression of the outgoing log stream between the participants delivers optimal performance and minimizes the network bandwidth used by database mirroring.
Automatic Recovery of Data Pages
SQL Server 2008 enables the principal and mirror machines to transparently recover from 823/824 types of data page errors by requesting a fresh copy of the suspect page from the mirroring partner transparently to end users and applications.
Transparent Data Encryption
Enable encryption of an entire database, data files, or log files, without the need for application changes. Benefits of this include: Search encrypted data using both range and fuzzy searches, search secure data from unauthorized users, and data encryption without any required changes in existing applications.
Performance Data Collection
Performance tuning and troubleshooting are time-consuming tasks for the administrator. To provide actionable performance insights to administrators, SQL Server 2008 includes more extensive performance data collection, a new centralized data repository for storing performance data, and new tools for reporting and monitoring.
Language Integrated Query (LINQ)
Enable developers to issue queries against data, using a managed programming language, such as C# or VB.NET, instead of SQL statements. Enable seamless, strongly typed, set-oriented queries written in .NET languages to run against ADO.NET (LINQ to SQL), ADO.NET DataSets (LINQ to DataSets), the ADO.NET Entity Framework (LINQ to Entities), and to the Entity Data Service Mapping provider. Use the new LINQ to SQL provider that enables developers to use LINQ directly on SQL Server 2008 tables and columns.
ADO.NET Data Services
The Object Services layer of ADO.NET enables the materialization, change tracking, and persistence of data as CLR objects. Developers using the ADO.NET framework can program against a database, using CLR objects that are managed by ADO.NET. SQL Server 2008 introduces more efficient, optimized support that improves performance and simplifies development.
Partitioned Table Parallelism
Partitions enable organizations to manage large growing tables more effectively by transparently breaking them into manageable blocks of data. SQL Server 2008 builds on the advances of partitioning in SQL Server 2005 by improving the performance on large partitioned tables.
There are many other exciting features of SQL Server 2008. If you want to know more about SQL Server 2008you can visit to the nearest NIIT Centre and ask for SQL Server 2008 program under New Technology Skill Enhancement series.
"Remember Data is not just Data anymore, it's a new form of Energy".
So keep upgrading yourself in latest technologies.
Happy Learning!!...
Cheers
Madhu S
Subscribe to:
Posts (Atom)