Showing posts with label Technical Interview. Show all posts
Showing posts with label Technical Interview. Show all posts

Monday, November 16, 2015

Primary Key, Foreign Key and Unique Key

SQL Primary Key

A primary key is a column whose values uniquely identify every row in a table. To define a field as primary key, following conditions had to be met :
  • No two rows can have the same primary key value.
  • Every row must have a primary key value
  • Primary key field can't be null
  • Values in primary key columns can never be modified or updated.
Primary key values can never be reused. If a row is deleted from the table, its primary key may not be assigned to any new rows in the future. In the examples given below, “Employee_ID” field is the primary key.

SQL Composite Primary Key

A Composite primary key is a  set of columns whose values uniquely identify every row in a table. For example, in the table given above , if "Employee_ID" and "Employee Name" together uniquely identifies a row its called a Composite Primary Key . In this case , both the columns will be represented as primary key.

SQL Foreign Key

When, "one" table's primary key field is added to a related "many" table in order to create the common field which relates the two tables, it is called a foreign key in the "many" table. In the example given below, salary of an employee is stored in salary table. Relation is established via foreign key column “Employee_ID_Ref” which refers “Employee_ID” field in Employee table.

For example, salary of "Jhon" is stored in "Salary" table. But his employee info is stored in "Employee" table. To identify the salary of "Jhon", his "employee id" is stored with each salary record. 

Foreign Key
The advantage of using foreign key is that, the data is not getting duplicated. If foreign key concept was not there in RDBMS, entire info of an employee, such as First Name, Last Name, Id etc. had to be stored with each and every salary entry. Another advantage of foreign key is that the editing master entry such as designation, address, etc. wont have any impact on the child table.

SQL Unique Key

Unique key is same as primary with difference being the existence of null. Unique key field allows one value as NULL value. It wont allow duplicate entries.

Concept of Primary Key, Foreign Key and Unique Key is same in all the databases.

Thursday, November 12, 2015

RDBMS and DBMS - Concepts and Basics

DBMS

Database management system is a collection of programs that enables user to store, retrieve, update and delete information from a database.

RDBMS

Relational Database Management system (RDBMS) is a database management system (DBMS) that is based on the relational model. Beauty about relational database is that the data stored in them can be retrieved or reorganized in different ways without making changes to the database tables. Data from relational database can be accessed using a API, Structured Query Language (SQL).

SQL

Structured Query Language(SQL) is a language designed specifically for communicating with databases. SQL is an ANSI (American National Standards Institute) standard.
Advantages of SQL
  • SQL is not a proprietary language used by specific database vendors. Almost every major DBMS supports SQL, so learning this one language will enable programmers to interact with any database like ORACLE, SQL Server, MySQL, DB2, Postgresql etc.
  • Learning SQL is very easy. We can make SQL statements using a predefined set of English words. Since there aren't many SQL keywords, it is very easy to remember them.
  • Very complex and precision oriented database operations can be performed using SQL statements. 
Database Definition
A DATABASE is a collection of logically related tables which are stored in a file or set of files. A database is a structured object that consists of data and metadata (Table definitions).

Tuesday, December 16, 2014

.NET Framework

1. What is .NET Framework?
.NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications:
  • Console applications
  • Windows Forms applications
  • Windows Presentation Foundation (WPF) applications
  • Web applications (ASP.NET applications)
  • Web services
  • Windows services
  • Service-oriented applications using Windows Communication Foundation (WCF)
  • Workflow-enabled applications using Windows Workflow Foundation (WF)

.NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language.

2. What are the main components of .NET Framework?
.NET Framework provides enormous advantages to software developers in comparison to the advantages provided by other platforms. Microsoft has united various modern as well as existing technologies of software development in .NET Framework. These technologies are used by developers to develop highly efficient applications for modern as well as future business needs. The following are the key components of .NET Framework:
  • .NET Framework Class Library
  • Common Language Runtime
  • Dynamic Language Runtimes (DLR)
  • Application Domains
  • Runtime Host
  • Common Type System
  • Metadata and Self-Describing Components
  • Cross-Language Interoperability
  • .NET Framework Security
  • Profiling
  • Side-by-Side Execution