Вы находитесь на странице: 1из 4


1st there was two level architecture including schema & subschema ...
but now a 3 level architecture
external level : the users view of db, it includes that part ofdb which s releva
nt to each user..
conceptual level : the community view of db, it includes all entities , their at
t & relationships , constraints on data, semantic info abt data, security & int
erity info.
internal level : the physical rep of db on comp, it inculudes storage spce, reco
rd description, record placement, data compressin, data encryption..
System.Data namespaces
The System.Data namespace provides access to classes that represent the ADO.NET
ADO.NET lets you build components that efficiently manage data from multiple dat
a sources.
The System.Data namespaces contain classes for accessing and managing data from
diverse sources.
The top-level namespace and a number of the child namespaces together form the A
DO.NET architecture and ADO.NET
data providers. For example, providers are available for SQL Server, Oracle, ODB
C, and OleDB. Other child namespaces
contain classes used by the ADO.NET Entity Data Model (EDM) and by WCF Data Serv
System.Data.SqlClient namespace
The System.Data.SqlClient namespace is the.NET Framework Data Provider for SQL S
The.NET Framework Data Provider for SQL Server describes a collection of classes
used to access a SQL Server database in the managed space.
Using the SqlDataAdapter, you can fill a memory-resident DataSet that you can u
se to query and update the database.
distinct and unique
Unique is a keyword used in the Create Table() directive to denote that a field
will contain unique data, usually used for natural keys,foreign keys etc.
For example:
Create Table Employee(
Emp_PKey Int Identity(1, 1) Constraint PK_Employee_Emp_PKey Primary Key,
Emp_SSN Numeric Not Null Unique,
Emp_FName varchar(16),
Emp_LName varchar(16)

i.e. Someone's Social Security Number would likely be a unique field in your tab
le, but not necessarily the primary key.
Distinct is used in the Select statement to notify the query that you only want
the unique items returned when a field holds data that may not be unique.
Select Distinct Emp_LName
From Employee
You may have many employees with the same last name, but you only want each diff
erent last name.
Obviously if the field you are querying holds unique data, then the Distinct key
word becomes superfluous.

type of database architecture

Logical view
Physical view end
User View
Most DBMS s use a three-level architecture: External, Internal and Conceptual
Internal - describes how the data is stored in the database (space allocation, c
ompression, encryption etc.) and interfaces with the OS to manage files in physi
cal storage
Conceptual - Describes what data is stored and the relationships between data
External - Defines the users view of the data
The three levels correspond to three schemas: there is one internal and one conc
eptual schema per DB, there can be many external sub-schema
The Three Levels
The overall description of the database is called the database schema
There are three different types of schemas in the database and these are defined
according to the levels of abstraction of the three-level architecture.
At the highest level is the External Schema (also called subschema), which corre
spond to the different views of data
At the conceptual level, there is the conceptual schema
At the lowest level of abstraction there is the Internal Schema, which is a comp
lete description of the internal model. There is only one Internal Schema
The DBMS maps the logical records of the conceptual schema to the internal schem
a, and maps the external views or sub-schemas to the conceptual schema.
The three tier DBMS is designed to insure that changes to the internal schema do
not affect the conceptual schema, and changes to the conceptual schema do not e
ffect (unduly) the external schemas
Data Independence
Logical Data Independence Refers to the immunity of external schemas to changes in the conceptual schema
Physical Data Independence Refers to the immunity of the conceptual schema to changes in the internal schem
The conceptual/internal mapping defines how conceptual records and fields are re
presented at the internal level.

Difference between Primary Key & Unique Key

Primary Key
que Key
1)Primary Key can't accept null value.
Unique key can
accept only one null value.
2)By default, Primary key is clustered index
By default, Unique
key is a unique non-clustered index.
and data in the database table is physically
organized in the sequence of clustered index.
3)We can have only one Primary key in a table. We can have more than one unique
key in a table.
4)Primary key can be made foreign key into
another table.
rver, Unique key can be made foreign key into another table.
enum, enumerator, ienumerable
enum keyword
The enum keyword is used to declare an enumeration, a distinct type that consist
s of a set of named constants called the enumerator list.
By default, the first enumerator has the value 0, and the value of each successi
ve enumerator is increased by 1.
For example, in the following enumeration, Sat is 0, Sun is 1, Mon is 2, and so
enum Days {Sat, Sun, Mon, Tue, Wed, Thu, Fri};
An enumerator cannot contain white space in its name.
The approved types for an enum are byte, sbyte, short, ushort, int, uint, long,
or ulong.
IEnumerator:defines the protocol by which elements in a collection traverse in a
forward only manner.
IENumerable:The basic interface that collection classes implement .By exposing
enumerator it provides flexibility
public class EnumTest
enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat };
static void Main()
int x = (int)Days.Sun;
int y = (int)Days.Fri;
Console.WriteLine("Sun = {0}", x);
Console.WriteLine("Fri = {0}", y);
/* Output:
Sun = 0
Fri = 5

Types of Constructor

Default Constructor
Parameterized Constructor


Copy Constructor
A parameterized constructor that contains a parameter of same class t
ype is called as copy constructor.
Main purpose of copy constructor is to initialize new instance to the
values of an existing instance.
Static Constructor
When we declared constructor as static it will be invoked only once for any numb
er of instances of the class and it s during the
creation of first instance of the class or the first reference to a static membe
r in the class.
Static constructor is used to initialize static fields of the class and to write
the code that needs to be executed only once.
Importance points of static constructor
Static constructor will not accept any parameters because it is automatic
ally called by CLR.
Static constructor will not have any access modifiers.
Static constructor will execute automatically whenever we create first in
stance of class
Only one static constructor will allowed.
Private Constructor
Private constructor is a special instance constructor used in a class that conta
ins static member only.
If a class has one or more private constructor and no public constructor then ot
her classes is not allowed to create instance of this class this
mean we can neither create the object of the class nor it can be inherit by othe
r class.
The main purpose of creating private constructor is used to restrict the class f
rom being instantiated when it contains every member as static.
Important points of private constructor
One use of private construct is when we have only static member.
Once we provide a constructor that is either private or public or any, th
e compiler will not allow us to add public constructor without
parameters to the class.
If we want to create object of class even if we have private constructors
then we need to have public constructor along with private constructor