Write a simple program on cursors?
Find out the 3rd highest salary?
select a.sal from emp a where 3=(select distinct(count(b.sal))
from emp b where a.sal<=b.sal) What are user defined stored procedures ? Stroed procedures are basically set of sql statements.User defined stored procedures are created by users in which they can use functions,procedures to get the desired result from database. Difference between views and materialized views? VIEWS: Takes the output of a query M.VIEWS: Stores the output of a query,Views can't store the results of a query. What is a self join ? A table is joined itself is called self join or Self referential integrity. What are different types of joins ? 1.Equi join 2.Non-equi join 3.cartegian join 4.outer join(+) >> a)left outer join
b)right outer join
5.self join
What is a trigger ?
Triggers are basically PL/SQL procedures that are associated with tables, and are fired whenever a certain modification (event) occurs. The modification statements may include INSERT, UPDATE, and DELETE.
The general structure of triggers is:
CREATE [OR REPLACE]TRIGGER trigger_name
BEFORE/AFTER
INSERT/UPDATE/DELETE ON tablename
[FOR EACH ROW [WHEN (condition)]]
BEGIN
...
END;
What is referential integrity ?
A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the value for the column or set of columns (the dependent value) matches a value in a column of a related table (the
referenced value). It also specifies the type of data manipulation allowed on referenced data and the action to
be performed on dependent data as a result of any action on
referenced data.
What is a constraint. Types of constraints ?
Constraint means it is rule which you want to apply on the table. There are two types of constraints.
1. Column Constraints: Applicable for that column only.
2. Table Constraints: Applicable for more than one column.
Column Constraints:
unique
not null
primary key
foreign key
default
check
Table constraints:
unique
primary key
foreign key
check
What is an index and types of indexes. How many number of indexes can be used per table ?
Index is a method used for faster retrieval of records.different types of indexes are
1.primary key index
2.unique index
3.bitmap index
4.hash index
5.function based index
6.B-tree index(default index created) on table.
7.Virtual index(which do not show entry in DBA_segment).
Indexs are used for the faster retrivel of data.
two types of indexes
Cluster index,unclustered index
we can have one cluster index and upto 249 uncluster indexes for a table
What is normalization ?
Normalization is the process of organizing the table to remove redundancy.
What is @@rowcount and with small code snippet explain the usage?
@@rowcount gives the number of rows given as an result of previous query ran.
Create procedure get_emp_count ( @emp_id int)
As
Select * from emp where emp_id =@emp_id
If @@rowcount = 0
Begin
Select 'no rows with emp_id= '
Select @emp_id
End
(OR)
UPDATE authors SET au_lname = 'Jones'
WHERE au_id = '999-888-7777'
IF @@ROWCOUNT = 0
print 'Warning: No rows were updated'
CSC
What is the basic functions for master, msdb, tempdb databases?
Master , MSDB and TempDB these are the inbuild Database which r provided by SQL SERVER.
All have their own functinality & responsbility like.
Master : Master DB is responsible for Storing all information at
system level.
MSDB : it is Microsoft DB, it creates a Copy of whole Database in it
TempDB : it stores all the log information of Server,it will initilize
automatically whenever Server will start,the max. size alloted from
TempDB is 10MB.
*******Honeywell
If we want to construct our own Garbage collector what are the steps things we have to do?
If you want to implement your own GC, you need to define you own memory cleaning by implementing destructors.
Also you have configure your GC in a separate long running thread which should be of Daemon Thread. (Background thread).
If we want to call the Garbage collector,use this command
system.gc.collect()
How Garbage Collector identifies the objects which are not in use?
Garbage Collector identifies a unused object using "referce counting"
reference countiing: how many times the object is used if the count is zero..its is unuesd....now the gc will release the resources..
C# makes use of the Finilize() destructor for this purpose.The CLR periodically checks the entire program for unused objects using the refrence tracing garbage collector which in turn invokes he Finilze() destructor to relese the memory of such objects.
Tell me about the internal working of Garbage collector?
The main objective of GC is Memory Management...Gc wil take initiative when ever the application meemory is low...we hav Finalize() method which runs implicitly...and Dispose() method which we hav to kal Explicity....
Gc identifies the unused objects with reference counting concept.Finalize() method runs implicitly and free the resources if the object having no references...in the case of Dispose() method it wont mind if the reference r ther.....
Gc maintain 4 Generation...start with 0 ..ends with 3 if GC released the resources using Finalize method() still u can get the object..coz dis method havin backup...it stores in generation0-3.
what is data access layer?
Data Access Layer which is receive a request from buisness object layer and speaks to database , get the result and return to buisness object.All sqls and Stored procedure execution will be placed.
Data access layer is nothing but EIS(Enterprise Information Server)which can store the databse objects associated to the webapplication.
If there is a Model class,View class,Controller class then How these are internally related? Which layer objects instantiated in which
layer? How they communicates?
If we will take in DotNet technology. Web based applications has implemented MVC Pattern.
ASPX is the View Class
ASPX.CS is the controller class
If we are using any Application Blocks / DLL Components that are model class.
What are actually Model,view,Controller in MVC Pattern?
MODEL:Model is nothing but storing the databse objects.
VIEW: View is nothing but userinterface
CONTROLLER: Controller is nothing but handling the requests and sending the response.
Which Design Patterns you know?
For this question u can answer like Singleton design pattern ,DAO and DTO,MVC.
The design pattern is broadly classified into
1. Creational (Factory, Abstract Factory, Singleton Prototype, and Builder)
2. Structural (Composite)
3. Behavioural (Observer)
what is MVC Pattern?
MVC is the one of the design pattern which enables you to de-coupling the modules.
MODEL:It cane be used to store the database objects.
VIEW: It can be used to view purpose,to giving the user input.
CONTROLLER:It is the main component in the MVC pattern,which can handle request and response mechanism.
If we want to connect to many databases in dataaccess layer such as MSAccess,Sql server,oracle means not to a particular database depends on condition we have to connect to appropriate database in this scenario if we without changing code Ho do you handle thissituation?
and use this Key name where it is needed
If you need SqlServer DataBase
using System.Data.SqlClient;
in DataAcess Layer
public SqlConnection Connection()
{
try
{
con = new SqlConnection (ConfigurationManager.AppSettings["SqlServerDatabase"].ToString().Trim());
return con
}
catch (Exception exp)
{
throw exp;
}
}
What is the difference between NOROW and LOCKROW?
When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory?
before invoking derived class constructor base-class constructor should be called.
first base-class object will be created then derived-class object will
be created.
here the base class constructor is private, so derived-class cannot
invoke it.
No object is created in derived-class.
Tech Mahindra
In which conditions do you opt for Remoting services?
Remoting can be prefered
Both server and Client sit in different machine.
Both server and client are .NET applications
The state of the objects transfered accross the network
should be maintained.
The objects of the IDictionary interface should be transfered accross
the network.
we are working in .net namespaces like using system.io,system.text.
these namespace before we use "using " keyword what means of using?
using keyword is used to intimate the compiler to load supported name spaces for our program.
Is it possible to use two versions of assembly at the same time?If possible explain with code?
First u have to create Windows Service..
For install Windows Service , u have to use one Command
first Build Windows Service..then use this command..
installutil.exe
installutil.exe/u -->For uninstall
u have to use this command in visual studio 2005 -> visual studio command Prompt -> write this above command..
Go in Particular path where u create Windows Service then go to Bin -->Debug --> then implement this above Command..
what are the differences between windows services and web services?
An XML Web service is a component that implements program logic and provides functionality for diseparate applications. These applications use standard protocols, such as HTTP, XML, and SOAP, to access the functionality. XML Web services use XML-based messaging to send and
receive data, which enables heterogeneous applications to interoperate with each other. You can use XML Web services to integrate applications that are written in different programming languages and deployed on different platforms. In addition, you can deploy XML Web services within an intranet as well as on the Internet. While the Internet brings users closer to organizations, XML Web services allow organizations to integrate their applications.
A Windows service starts much before any user logs in to the system (if it has been setup to start at boot up process). A Windows service can also be setup in such a way that it requires a user to start it manually ? the ultimate customization!Windows services run as background processes. These applications do not have a user interface, which makes them ideal for tasks that do not require any user interaction. You can install a Windows service on any server or computer that is running Windows 2000, Windows XP, or Windows NT. You can also specify a Windows service to run in the security context of a specific user account that is different from the logged on user account or the default computer account. For example, you can create a Windows service to monitor performance counter data and react to threshold values in a database.
what is the difference between trigger and storedprocedures
procedure is invoked explicitly by the user and trigger is executed
implicitly.
procedure cannot have the same name as table name,funtion name or
package name but trigger can have same name as table name or
procedure name.
Trigger is compiled code where as stroed procedure is not.
triger in action which is performed automatically before or after a
event occur and stored procedure is a procedure which is executed
when the it is called.
Is it possible to use two versions of assembly at the same time?If possible explain with code?
It is possible. I think it is called as side by side execution.
No comments:
Post a Comment