0% found this document useful (0 votes)
20 views31 pages

What Are The MySQL Clients and Utilities

This document discusses MySQL clients and utilities. It lists mysql, mysqladmin, mysqldump, and mysqlcheck/myisamchk as some of the most important administrative programs. Mysql is an interactive program to send SQL statements and view results. Mysqladmin performs administrative tasks like shutting down servers. Mysqldump backs up databases. Mysqlcheck and myisamchk help perform table checks, analysis, optimization and repairs.

Uploaded by

vipul jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views31 pages

What Are The MySQL Clients and Utilities

This document discusses MySQL clients and utilities. It lists mysql, mysqladmin, mysqldump, and mysqlcheck/myisamchk as some of the most important administrative programs. Mysql is an interactive program to send SQL statements and view results. Mysqladmin performs administrative tasks like shutting down servers. Mysqldump backs up databases. Mysqlcheck and myisamchk help perform table checks, analysis, optimization and repairs.

Uploaded by

vipul jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

1) What are the MySQL clients and utilities?

Several MySQL programs are available to help you communicate with the server. For
administrative tasks, some of the most important ones are listed here:

• mysql : An interactive program that enables you to send SQL statements to the server
and to view the results. You can also use mysql to execute batch scripts (text files
containing SQL statements).

• mysqladmin : An administrative program for performing tasks such as shutting down


the server, checking its configuration, or monitoring its status if it appears not to be
functioning properly.

• mysqldump : A tool for backing up your databases or copying databases to another


server.

• mysqlcheck and myisamchk : Programs that help you perform table checking,
analysis, and optimization, as well as repairs if tables become damaged. mysqlcheck
works with MyISAM tables and to some extent with tables for other storage engines.
myisamchk is for use only with MyISAM tables.

• 2) What are the disadvantages of struts?


• There is no documentation.
• Transparency isn't complete.
• There is only one servlet controller.
• There is a great deal to learn.
• The strategy is unyielding

advantages does the Struts framework offer?


Because Struts is built on MVC, there is a strong separation of the various layers,
making the creation and modification of Struts applications simple. Struts
applications are easily changeable thanks to the use of several configuration files.
Struts is also open source and therefore inexpensive.
3) What is abstract method explain

An Abstract method is a method without a body. The implementation of


an abstract method is done by a derived class. When the derived class
inherits the abstract method from the abstract class, it must override the
abstract method. This requirment is enforced at compile time and is also
called dynamic polymorphism.

The syntax of using the abstract method is as follows:

<access-modifier>abstract<return-type>method name (parameter)

The abstract method is declared by adding the abstract modifier the method.

4) How many Triggers are possible in MySQL?

A MySQL trigger is a stored program (with queries) which is executed


automatically to respond to a specific event such as insertion, updation or
deletion occurring in a table.
There are 6 different types of triggers in MySQL:
1. Before Update Trigger:
As the name implies, it is a trigger which enacts before an update is
invoked. If we write an update statement, then the actions of the trigger will
be performed before the update is implemented.

Before and After insert,update , delete


5) Table Normalization, Basic Sql Query and query to find Second Highest Salary
from table.
Note : Sql test with mcq for web based & desktop based

Prepare mcq and concept sql

SELECT max(Sal) FROM EMP where sal<(SELECT max(Sal) FROM EMP)

6) Difference between primary & unique key. Truncate & Delete. Union and Union
all. Having and where clauses. Some queries using joins. Denormalization.

Parameters PRIMARY KEY UNIQUE KEY

Used to serve as a unique


Uniquely determines a row
Basic identifier for each row in a
that isn’t the primary key.
table.

NULL value
Cannot accept NULL values. Can accept NULL values.
acceptance

Number of keys that


can be defined in the Only one primary key More than one unique key
table

Index Creates clustered index Creates non-clustered index

A unique key does not


A Primary key supports auto-
Auto Increment support auto-increment
increment value.
value.
Parameters PRIMARY KEY UNIQUE KEY

We cannot change or delete


We can change unique key
Modification values stored in primary
values.
keys.

The Unique Key is used for


The primary Key is used for
Uses preventing duplicate
indicating the rows uniquely.
entries.

CREATE TABLE House


CREATE TABLE Student
(
(
House_Number INT
Student_Id INT PRIMARY
UNIQUE,
KEY,
Syntax House_Name
Student_name
VARCHAR(150),
VARCHAR(150),
House_Address
roll_number INT(10)
VARCHAR(250)
)
)
Delete Truncate

The DELETE command is used


While this command is used to delete all
to delete specified rows(one or
the rows from a table.
more).

It is a DML(Data Manipulation While it is a DDL(Data Definition


Language) command. Language) command.

There may be a WHERE clause


While there may not be WHERE clause
in the DELETE command in
in the TRUNCATE command.
order to filter the records.

In the DELETE command, a


While in this command, the data page is
tuple is locked before removing
locked before removing the table data.
it.

The DELETE statement removes TRUNCATE TABLE removes the data by


rows one at a time and records deallocating the data pages used to
an entry in the transaction log store the table data and records only the
for each deleted row. page deallocations in the transaction log.

DELETE command is slower While the TRUNCATE command is


than TRUNCATE command. faster than the DELETE command.

To use Delete you need DELETE To use Truncate on a table we need at


permission on the table. least ALTER permission on the table.

The identity of the fewer column Identity the column is reset to its seed
retains the identity after using value if the table contains an identity
DELETE Statement on the table. column.

The delete can be used with Truncate cannot be used with indexed
indexed views. views.

This command can also active


This command does not active trigger.
trigger.
Delete Truncate

DELETE statement occupies


Truncate statement occupies less
more transaction spaces than
transaction spaces than DELETE.
Truncate.

Delete Truncate
1) It can remove either all records or specific 1) It can remove all the records of the table
record. only
2) Even though we are deleting all the records 2) In this case all the records will be removed
the deletion will be done row by row. at a time. So it executes faster than the delete
command.
3) After deleting all the records when we insert 3) In this case auto generation will be
a new record in the IDENTITY column auto restarted from the beginning.
generation will be continued normally with the
next higher number.
4) It maintains removed record details in log 4) It maintains removed data page details in
file. log file.

The only difference between Union and Union All is that Union extracts the
rows that are being specified in the query while Union All extracts all the
rows including the duplicates (repeated values) from both the queries.

SELECT <column list> FROM <tablename>


[WHERE <condition>
[GROUP BY <column name>]
[HAVING <Condition based on the grouped data>]
[ORDER BY <column name> [ASC | DESC] ]
SR.NO. WHERE Clause HAVING Clause

WHERE Clause is used to filter


HAVING Clause is used to filter
the records from the table
1. record from the groups based
based on the specified
on the specified condition.
condition.

WHERE Clause can be used HAVING Clause cannot be used


2.
without GROUP BY Clause without GROUP BY Clause

WHERE Clause implements in HAVING Clause implements in


3.
row operations column operation

WHERE Clause cannot contain HAVING Clause can contain


4.
aggregate function aggregate function

WHERE Clause can be used


HAVING Clause can only be
5. with SELECT, UPDATE, DELETE
used with SELECT statement.
statement.

WHERE Clause is used before HAVING Clause is used after


6.
GROUP BY Clause GROUP BY Clause

WHERE Clause is used with HAVING Clause is used with


7. single row function like UPPER, multiple row function like SUM,
LOWER etc. COUNT etc.

1. SELECT COUNT (aggregate_expression)


2. FROM table_name
3. [WHERE conditions];

The COUNT() function returns the number of records returned by a select


query.
Returns the number of unique or all records specified in expression.
Denormalization is a technique used by database administrators to optimize the efficiency of
their database infrastructure. This method allows us to add redundant data into a normalized
database to alleviate issues with database queries that merge data from several tables into a
single table. The denormalization concept is based on the definition of normalization that is
defined as arranging a database into tables correctly for a particular purpose.

Pros of Denormalization

Enhance Query Performance

Make database more convenient to manage

Facilitate and accelerate reporting

Cons of Denormalization
The following are the disadvantages of denormalization:

o It takes large storage due to data redundancy.


o It makes it expensive to updates and inserts data in a table.
o It makes update and inserts code harder to write.
o Since data can be modified in several ways, it makes data inconsistent. Hence,
we'll need to update every piece of duplicate data. It's also used to measure
values and produce reports. We can do this by using triggers, transactions,
and/or procedures for all operations that must be performed together.

The denormalization is different from normalization in the following manner:

o Denormalization is a technique used to merge data from multiple tables into a


single table that can be queried quickly. Normalization, on the other hand, is
used to delete redundant data from a database and replace it with non-
redundant and reliable data.
o Denormalization is used when joins are costly, and queries are run regularly on
the tables. Normalization, on the other hand, is typically used when a large
number of insert/update/delete operations are performed, and joins between
those tables are not expensive.

7) knowledge of SQL concepts and OOPS concepts, asp.net, C#,.


Group by clause, Normalization, rank, partition, SQL programming
It is used to group the table data based on a column. After grouping the table data, we can able to
apply an aggregate function on each group independently. The aggregations include: COUNT, MIN,
MAX, AVG and SUM.

SELECT <column list> FROM <tablename>


[WHERE <condition>
[GROUP BY <column name>]
[HAVING <Condition based on the grouped data>]
[ORDER BY <column name> [ASC | DESC] ]

It is the process of reducing redundancy & applying relation to the data.


It is a step-by-step process. Each step is called as a Normal Form. Each Normal Form will contain a
set of rules that are to be satisfied by the tables.
In general 6 NF’s are available. They are:
1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Almost all real time project data base designs will be ended with 3NF’s. They are:
1NF:
It defines that all the tables must not contain any duplicate data.
2NF:
It defines that all the non-key columns must depend on the primary key columns.
PK C1 C2 C3
C2, C3➔ Non-Key columns
3NF:
It defines that all the non-key columns must depend only on the PK. There should be no internal
dependency b/w the non-key columns.

PK C1 C2 C3

The Purpose of Normalization


Normalization is a technique for producing a set of relations with desirable properties, given the
data requirements of an enterprise.

The process of normalization is a formal method that identifies relations based on their primary or
candidate / foreign keys and the functional dependencies among their attributes.

The RANK function Returns an increasing unique number for each row starting
from 1 and for each partition. When there are duplicates, the same rank is assigned
to all the duplicate rows, but the next row after the duplicate rows will have the rank
it would have been assigned if there had been no duplicates. So the RANK function
skips rankings if there are duplicates.

The PARTITION BY clause is basically used to partition the result set into multiple
groups. As it is optional, and if you did not specify the PARTITION BY clause, then
the RANK function will treat the entire result set as a single partition or group. The
ORDER BY clause is required and this clause is used to define the sequence in
which each row is going to assign their RANK i.e. number.

SELECTName,Department,Salary,
RANK()OVER(
PARTITIONBYDepartment
ORDERBYSalaryDESC)AS[Rank]
FROM Employees

https://dotnettutorials.net/lesson/rank-dense_rank-function-sql-server/

8) Simple SQL Join,Indexing, NF, And Dot Net basic Questions are There

• about your project


• check if you can work under pressure.

JOIN:
- A JOIN is a clause used to combine rows from two or more tables based on related column
between them
- Used to JOIN two or more tables
- Used by backend developers during integration testing to join the database tables of multiple
modules
Integration Testing:
Module 1=Tested Individually=Table1
Module 2=Tested Individually=Table2
Module 3=Tested Individually=Table3

Different Types of JOINs:


Here are the different types of JOINs:
- INNER JOIN-Returns records that have matching values in both the tables
- LEFT(OUTER) JOIN: Returns all records from the left table and the matched records from
right table
- RIGHT(OUTER) JOIN: Returns all the records from the right table and matched records from
left table
- FULL (OUTER)JOIN: Returns all records when there is a matched either in LEFT or Right table
- SELF JOIN: Joining a table to itself is called Self-JOIN.

Index:
- Indexes are used to retrieve data from the database table more quickly than otherwise
- Users cannot see these indexes, but they are used to speed up the searches/queries.

Syntax:
CREATE INDEX index_name
ON table_name(Column1,Column2,…,ColumnN);
Ex:
CREATE INDEX SALARY_Greater ON Customers(SALARY);

To See Indexes:
Show index from table_name
Ex:
Show Index from Customers;

To Remove Index:
DROP Index SALARY_Greater ON Customers;

9) aggregation Queries. sql queries, joins, normalization , .net programming


Examples of Aggregate functions SELECT Returns the average value of all the price
‘Average Price”=AVG(price) FROM titles values in the titles table with user-defined
heading.
SELECT ‘Sum’=SUM(DISTINCT advance) Returns the sum value of all-the unique
FROM titles advance values in the titles table with
user-defined heading.
SELECT ‘Minimum Ytd Returns the minimum value of ytd_sales
Sales’=MIN(ytd_sales) FROM titles value in the titles table with user-defined
heading.
SELECT ‘Maximum Ytd Returns the maximum value of ytd_sales
Sales’=MAX(ytd_sales) FROM titles in the titles table with user-defined
heading.
SELECT ‘Unique Price’= COUNT(DISTINCT Returns the number of unique price
price) FROM titles values in the titles table with user-defined
heading.
SELECT ‘Price=COUNT(price) FROM titles Returns the number of total number of
price values in the titles with user-defined
heading.

10) : Method Overloading, Method Overriding, OOPS Concepts Assembly in C# Manifest


GAC Garbage Collector Index(All Types) JOINS(All types) Triggers in SQL Stored
Procedure vs Functions Find 2nd max salary, Some complex JOIN Queries Etc
Inheritance is the procedure in which one class inherits the attributes and
methods of another class.
In other words It is a mechanism of acquiring properties or behaviors of
existing
class to a new class
The Base Class, also known as the Parent Class is a class, from which other
classes are derived.
The Derived Class, also known as Child Class, is a class that is created from an
existing class
There are four types of inheritance in OOP:
Single Level Inheritance
Hierarchical Inheritance
Multi-Level Inheritance
Multiple Inheritance
Hybrid inheritance

Why Java or C# don’t support multiple inheritance?


because of following reasons –
Ambiguity Around The Diamond Problem Multiple inheritance does complicate
the design and creates problem during casting, constructor chaining etc
Polymorphism is the ability of an object to take on many forms.
we can define polymorphism as the ability of a message to be displayed in
more than one form
A) STATIC POLYMORPHISM: A method which will bind at compile time will execute inruntime is called as
static polymorphism or early binding or compile time polymorphism B) DYNAMIC POLYMORPHISM: A
method which will bind at compile time will notexecute, instead of that a method which will bind at runtime
will execute is called asRUNTIME POLYMORPHISM (or) DYNAMIC POLYMORPHISM is nothing but
LATEBINDING.
1. Compile time polymorphism:
This type of polymorphism is achieved by function overloading or operator
overloading.
Function overloading:
When there are multiple functions with same name but different parameters
then these functions are said to be overloaded. Functions can be overloaded
by change in number of arguments or/and change in type of arguments
multiple methods of same names performs different tasks within the same
class.
2.Runtime polymorphism:
Runtime polymorphism refers to the process when a call to an overridden
process is resolved at the run time.
This type of polymorphism is achieved by Function Overriding.
Function Overriding:
on the other hand, occurs when a derived class has a definition for one of the
member functions of the base class.
methods having same name which can have different functionalities.
That base function is said to be overridden.
Encapsulation is the process of binding data and methods in a single unit.
In encapsulation, data(variables) are declared as private and methods are declared as public.

The main advantage of encapsulation is that data is hidden and protected from randomly access
by outside non-member methods of a class.
Allows to hide unnecessary data from the user. This reduces program
complexity efforts.
it displays only the necessary information to the user and hides all the internal
background details.
If we talk about data abstraction in programming language, the code
implementation is hidden from the user and only the necessary functionality is
shown or provided to the user.

Eg.
-All are performing operations on the ATM machine like cash withdrawal etc.
but we can't know internal details about ATM
-phone call we don’t know the internal processing
A) An Assembly is a unit of code which provides versioning and deployment.
Assemblies are of 2 types:-
1. Private Assembly
2. Shared Assembly

Manifest is used to store assembly metadata. It contains all the metadata which are
necessary for following things.
o Version of assembly
o Security identity
o Scope of the assembly
o To resolve references to resources and classes

GAC stands for GLOBAL ASSEMBLY CACHE. IT is a residence for all SHAREDASSEMBLIES. When we
install .NET software, GAC folder will create within the followingpath C:\Windows\Assembly

A) In .NET, MEMORY MANAGEMENT is handling by GARBAGE COLLECTOR (GC). GCis an integral part
of CLR. To perform memory Management GC will do 2 duties.
1.Allocating the Memory ->
When new object is created by application garbage collector will allocate memory for thatobject with in
Managed heap.
2. De-Allocating the Memory:- ->
When an object is not using by the application garbage collector will recognize it asunused object..and
garbage collector will destroy unused objects according to generationalgorithm.
What is Managed Code and Unmanaged
The code which is taking the help of CLR for execution is called as managed code.
All .net languages code is managed code. VB.Net code, C#.Net code…etc
The code which is not taking the help of CLR for execution is called as Unmanagedcode..
In .net application non .net code is unmanaged code..
VB Code, VC++ Code…
SQL Indexes are used in relational databases to retrieve data quickly. They are similar to
indexes at the end of the books whose purpose is quickly finding a topic. SQL provides
Create Index, Alter Index, and Drop Index commands used to create a new index,
update an existing one, and delete an index in SQL Server.

Clustered Index in SQL Server


A B-Tree (computed) clustered index is the Index that will arrange the rows
physically in the memory in sorted order.

An advantage of a clustered index is that searching for a range of values will be


fast. you can create only one clustered Index for a table.

Nonclustered Index in SQL Server


• A nonclustered index is an index that will not arrange the rows
physically in the memory in sorted order.
• An advantage of a nonclustered index is that searching for the values
in a range will be slower.
• You can create a maximum of 999 nonclustered indexes on a table,
254 up to SQL Server 2005.

Function must return a value. Stored Procedure may or not return values.
Will allow only Select statements, it
Can have select statements as well as DML statements s
will not allow us to use DML
update, delete and so on
statements.
It will allow only input parameters,
It can have both input and output parameters.
doesn't support output parameters.
It will not allow us to use try-catch
For exception handling we can use try catch blocks.
blocks.
Transactions are not allowed within
Can use transactions within Stored Procedures.
functions.
We can use only table variables, it will
Can use both table variables as well as temporary table
not allow using temporary tables.
Stored Procedures can't be called
Stored Procedures can call functions.
from a function.
Procedures can't be called from Select/Where/Having an
Functions can be called from a select
statements. Execute/Exec statement can be used to call
statement.
Procedure.
A UDF can be used in join clause as a
Procedures can't be used in Join clause
result set.
• 11) types of joins ,self join- manager and employee query
• Normalisation and UI design based on normalised data
• distinct, group by, 2nd highest salaried employee

Self Join:
Joining a table to it self is called as a self-join. In a self-join, since we are using the same table
twice, to distinguish the two copies of the table, we will create to table aliases.
In the syntax of self join we never use the keyword ‘self’. Internally, we perform an inner join
only.
Ex: Get the employee details along with manager names from the EMP table. In this table one the
employee will be the manager for other employee.
Sol:
Select a.empid,a.ename,a.mgrid,b.ename mgrName
From emp a inner join emp b On a.mgrid=b.empid
Output: ename mgrid MgrNam
empid e
101 B 104 E
102 C 103 D
103 D 101 B
104 E 100 A

DISTINCT:
- It is SQL Clause/Keyword used in conjunction with SELECT statement
- Returns only DISTINCT Values
- Inside a table column often contains duplicate values, sometimes we want unique values
- Only returns distinct records or values(Unique/Different values)
Syntax:
SELECT DISTINCT Column_name
FROM Table_name;

12) They mainly ask joins and also we prepared for puzzle questions in HR round.
• minimum iteration to find out heaviest ball among 9 balls, in wich 8 balls are of
equal weight?

https://www.geeksforgeeks.org/minimum-comparisons-required-to-find-the-only-heavier-ball-from-
n-balls/

• 13) when u will for denormalization


Denormalization is used when joins are costly, and queries are run regularly on the
tables

Enhance Query Performance

Make database more convenient to manage

Facilitate and accelerate reporting

14) to normalize the table, partition, sub query correlated query, indexs and column
identity

• normalised the following tables, make 3 tables

In a normal SubQuery, at first, the inner query will be executed and only once. Based on the result
next higher query will be executed.
Where as in a correlated SubQuery, the inner query will be executed for each record of the parent
statement table. The internal execution process of this SubQuery will be as follows:
1) A record value from the parent table will be passed to the inner query.
2) The inner query execution will be done based on that value.
3) The result of the inner query will be sent back to the parent statement.
4) The parent statement finishes the processing for that record.

IDENTITY:
This property will be used to generate a number automatically in the column. The auto generation
can be controlled with seed and increment values.
Seed specifies initial value of the column.
Increment specifies how much the previous value should be incremented for each insert.
A table must contain only one identity property. It must be specified on a numeric column only.
Ex:
1) create table customers
2) (custid int IDENTITY(10,1),
3) custname char(10))
15) asp.net and ado.net mcq questions.. F2F interview on ASP.NET & ADO.NET
Interview Questions
• diff between union and unionall
• denormalization
• 1)Difference between abstract class & Interface 2)Stored Procedures & many
more

A SP is a database object that contains a set of pre-compiled re-executable statements as a unit.


The main advantages of a SP are:
Reusability
High performance
Reusability:
If we are executing some set of statements repeatedly instead of writing the code again & again.
We can specify the code under the procedure and activate the procedure whenever it is required.
High performance:
A procedure will contain pre-compiled code inside it. Whenever we execute the procedure it
directly executes the program without compilation. This will reduce execution time there by
improves performance.
Syn:
1) CREATE PROCEDURE<Procedure Name>
2) (@parameter1 <datatype> [output,@parameter2])
3) AS
4) BEGIN
5) ------------------
6) ------------------
7) <Executable Stmt>
8) ------------------
9) END

Ex: Create a procedure to insert a record into products table.


1) Create procedure spaddprod(@pid int,@pn char(10),@pqty int)
2) AS
3) BEGIN
4) Insert into products values(@pid,@pn,@pqty)
5) END

Calling a procedure:
The “EXEC” statement can be used to call the procedure by passing values to the parameters.
Syn: EXEC <procedure name> <val1>,val2>,@parameter output
Ex: EXEC spaddprod 1,’P1’,200 →Correct

16) ) what is denormalization. where to use it


• create databse structure, which normalization suitable for it, to store candidate
personal info such as phone no, name , address, etc. Must prepare your self to
solve queries.

• 17) .different types of indexes?which one is fastest?why?

, when an index is present on a column, it creates a separate data structure that


organizes the column values in a sorted manner. This sorted structure enables the
database to perform a faster search operation using various algorithms like binary search
or B-tree traversal.

Here are a few reasons why an index can provide faster retrieval compared to a search
without an index:

1. Reduced Data Access: With an index, the database can directly locate
the relevant data pages or rows containing the desired values. It doesn't
need to scan the entire table, resulting in significant reduction of data
access and I/O operations.
2. Smaller Search Space: The index structure provides a narrower search
space, allowing the database to eliminate a large portion of the data
that doesn't match the search criteria. This pruning of irrelevant data
leads to quicker identification of the desired records.
3. Optimized Disk Access: Since an index typically resides in a separate
data structure, it is designed to be more compact and fit in memory. As
a result, reading and searching through the index requires fewer disk
I/O operations compared to scanning a larger table, resulting in
improved performance.
4. Search Algorithms: Indexes employ efficient search algorithms like
binary search or tree traversal, which have lower time complexity
compared to linear searches. These algorithms can quickly navigate the
index structure to locate the desired values, reducing the time required
for retrieval.
18) - Find 2nd highest salary SQL - Find distinct records SQL - Difference between where
and having clause etc. .Net - where shared assembly are stored. etc. .Net interview - how
update panel work .Net interview - Difference between viewdata and viewbag.

GAC stands for GLOBAL ASSEMBLY CACHE. IT is a residence for all SHAREDASSEMBLIES

how to add partial page update support to a web page by using two Microsoft Ajax
server controls the ScriptManager Control and the UpdatePanel Control. Using
UpdatePanel control we can refresh only required part of the page instead of whole
page.

You can refresh the selected part of the web page by using UpdatePanel control,
Ajax updatepanel control contains a two child tags that is ContentTemplate and
Triggers. In a ContenTemplate tag we used to place the user controls and the
Trigger tag allows you to define certain triggers which will make the panel
update its content.

1. <asp:UpdatePanel ID="updatepnl" runat="server">


2. <ContentTemplate>
All the contents that must be updated asynchronously (only contenttemplate
parts are updated and rest of the web page part is untouched) are placed here.
It allows us to send request Or post data to server without submitting the whole
page so that is called asynchronous.

ViewData VS ViewBag VS TempData

ViewData ViewBag TempData


It is Key-Value Dictionary collection It is a type object It is Key-Value Dictiona

ViewData is a dictionary object and it is ViewBag is Dynamic property of ControllerBase TempData is a dictiona
property of ControllerBase class class. property of controllerB

ViewData is Faster than ViewBag ViewBag is slower than ViewData NA


ViewData is introduced in MVC 1.0 and ViewBag is introduced in MVC 3.0 and available in TempData is also introd
available in MVC 1.0 and above MVC 3.0 and above available in MVC 1.0 an

ViewData also works with .net framework ViewBag only works with .net framework 4.0 and TempData also works w
3.5 and above above 3.5 and above

Type Conversion code is required while In depth, ViewBag is used dynamic, so there is no Type Conversion code i
enumerating need to type conversion while enumerating. enumerating

Its value becomes null if redirection has TempData is used to pa


Same as ViewData
occurred. two consecutive reque

TempData only works d


It lies only during the current request. Same as ViewData
and subsequent reques

19) basics CLR, CTS ABSTRACT STATIC INTERFACE, Sql queries joins cursor and nested
join.

CLR stands for Common Language Runtime, it is .net execution. CLR is a common execution engine
for all .NET Languages that means every .NETlanguage application has to execute with the help of CLR

CTS (Common Type System) is a subset of CLS. It is a set of common based datatypes defined by
Microsoft for all .NET Languages.

2. Every .NET Language has to map their data types with CTS types.

cls -set rules guidelines for interoperbility / cross code compatibilty

CTS- comon data types


Whenever we want to have common value for every object and value should not bechanged forever we will
go for static readonly.

A cursor is a pointer to the result of a SELECT statement. The following are the features provided
by a cursor.
Allowing positioning at specific rows of the result set.
Retrieving one row or block of rows from the current position in the result set.
Supporting data modifications to the rows at the current position in the result set.
Supporting different levels of visibility to changes made by other users to the database data that
is presented in the result set.
Providing Transact-SQL statements in scripts, stored procedures, and triggers access to the data
in a result set.

Types of Cursors:
1) Static cursors
2) Dynamic cursors
3) Forward-only cursors
4) Keyset-driven cursors
Cursor Statements:
We can control the records of a result set with the use of these cursor statements.
They are:
▪ DECLARE
▪ OPEN
▪ FETCH
▪ CLOSE
▪ DEALLOCATE

DECLARE Statement is used to provide cursor declarations such as name


Of the cursor, the select statement to which result set the cursor should point etc

declare @tblname varchar(255)


declare tblcursor cursor
for select table_name from information_schema.tables
where table_type='base table'
open tblcursor
fetch next from tblcursor into @tblname
while @@fetch_status=0
begin
dbcc dbreindex(@tblname)
fetch next from tblcursor into @tblname
end
close tblcursor
deallocate tblcursor

Nested SubQueries:
A Nested SubQuery is a select statement, containing another select statement, which contains
another select statement and so on. Such type of nesting nature of select statements is called as a
nested subquery. In these SubQueries, at first, the innermost query will be executed and
based on the result next higher query will be executed and so on. A maximum of 32 select
statements can be combined in these nested SubQueries.
Ex: Get the Third maximum salary from the emp table
Sol:
SELECT max(sal) FROM EMP WHERE sal<(SELECT max(sal) FROM EMP
WHERE sal<(SELECT max(sal) FROM EMP))

20)

• 1st is the sql test most of the query basic and advance query and mostly all
concepts regarding database. Normalization, all basic concepts,functions,joins
prepared well for this ,if you clear this round next will be on .net concepts
• , joining three tables

JOIN Three Tables


The following SQL statement selects all orders with customer and shipper
information:

Example
SELECT Orders.OrderID, Customers.CustomerName, Shippers.ShipperName
FROM ((Orders
INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID)
INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID);

Using JOINS in SQL:

Using the Parent-child Relationship


21) . Firing of the question directly start from ASP.net (Web Developers) and
WinForm (Windows Developer)

Interview Questions
• write a sql query to swap the genders i.e. from male to female and vice versa ?

20

update table_Name set gender=case when gender='Male' then 'Female' when
gender='Female' then 'Male' end

You might also like