mysql ....question and answer by muhammed thanveer melayi

7
Keys Key is one or more fields /columns in database table, it is used to fetch or retrieve data from tables according to condition.. Super key It is set of one or more keys used to identify a record in table …example for….primary key, alternative key, unique key Candidate key It is set of one or more fields /columns used to identify uniquely a record in a table…. Primary key It is one or more field /columns in table, used to identify a record uniquely in table. It cannot accept null values and duplicate values. If create a primary key when create a index too…. Unique key It is set of one or more fields /columns used to identify uniquely a record in a table….it is as like primary key. But it accept only one null value , no duplicate values.. Alternative key It is basically candidate key ..while it may perform as primary key Composite /compound key Combination of more than one fields/columns …it can be primary key or candidate key Foreign key MYSQL… …IN SHORT WAY TO ANSWER

description

enjoy it

Transcript of mysql ....question and answer by muhammed thanveer melayi

Page 1: mysql ....question and answer by muhammed thanveer melayi

KeysKey is one or more fields /columns in database table, it is used to fetch or retrieve data from tables according to condition..

Super key

It is set of one or more keys used to identify a record in table …example for….primary key, alternative key, unique key

Candidate key

It is set of one or more fields /columns used to identify uniquely a record in a table….

Primary key

It is one or more field /columns in table, used to identify a record uniquely in table. It cannot accept null values and duplicate values. If create a primary key when create a index too….

Unique key

It is set of one or more fields /columns used to identify uniquely a record in a table….it is as like primary key. But it accept only one null value , no duplicate values..

Alternative key

It is basically candidate key ..while it may perform as primary key

Composite /compound key

Combination of more than one fields/columns …it can be primary key or candidate key

Foreign key

It is a special field in database that primary key of another table. It accept multiple null values and duplicate values.

JoinsJoin is combination of rows in two or more tables

Inner join

MYSQL……IN

SHORT WAY TO ANSWE

R

Page 2: mysql ....question and answer by muhammed thanveer melayi

it will return all rows which at least one match in both table..

left join

it return all rows from left table and matched table from right table

right join

it return all rows from right table and matched rows from left table

full join(sql)

return all rows from both tables

statementsdata manipulation language(dml)

it is used to store ,retrieve ,modify, delete and update data in database…… example: insert, delete.

Data definition language (ddl)

It is used to create, modify the structure of database object in database. Example: create , alter, truncate, drop .

(we use delete when delete the date only but storage space is remind. While use the truncate when delete data with the storage space also. That means it affected the structure of table)

Data control language (dcl)

It is used to gives permission , roles and referential integrity to database by securing it.it can be Grant or Revoke .

Grand: it gives user’s access privilege to database

Revoke: it withdraw access privilege given with Grant command.

Syntax:

GRANT privilege_name ON object_name TO {user_name |PUBLIC |role_name} [WITH GRANT OPTION]; 

Transaction control language(tcl)

Page 3: mysql ....question and answer by muhammed thanveer melayi

It is manage changes made by DML statement…

TransactionIt is a logical unit of work that contains one or more sql statements in database. It may Commit or Role back…TRANSACTION make multiple changes in database , either the changes are succeed when the transaction is committed.. if changes are undone when it is role back..

syntax

Start /begin transaction

Commit

Role back.

Store procedureIt is group of sql statement that created and stored in database. It reduce network traffic and increase performance.

It is faster, reduce network traffic , allow modular programming( that means once create a store procedure then call it several time)

Syntax

Create procedure procedure_name

<parameter ><data type>

( IN/OUT)

as

Begin

<body of procedure >

End

Call it with procedure_name with parameter value

Stored functionIt is a special kind of stored program that return a single value.

Page 4: mysql ....question and answer by muhammed thanveer melayi

NormalizationIt is a process where database is designed in a way that reduce redundancy (duplicate values) and increase the clarity of organizing data in database…it reduce the usage of storage space and fast…

See more …. http://www.w3schools.in/dbms/database-normalization

View It is a virtual table based on result set of sql statement. It has rows and columns like real table ..view did not take storage space and it is secure

Syntax

Create view view_name

As

Select columns_names from table_name

Where condition

IndexIt is used to find rows with specified column value quickly.

Syntax

Create index index_name

On table_name(column_name)

CursorIt is variable in sql database.. it is used for row by row operation. it is used to fetch multiple rows ….

Syntax

Declare cursor_name cursor for select_statements

Page 5: mysql ....question and answer by muhammed thanveer melayi

See more …. http://www.mysqltutorial.org/mysql-cursor

aggregative functionIt is return single value which calculate from values in columns ….. ex: avg();count();sum()…..

scalar functionIt is return single value based on the input value………ex: L case;U case.

declare handlerIt is specific handler that each may deal with one or more conditions.if one of those condition is occur, the specific statement is executed..

Example:

DECLARE handler_action HANDLER

FOR condition_value [, condition_value] ...

statement

handler_action:

CONTINUE

| EXIT

| UNDO

condition_value:

mysql_error_code

| SQLSTATE [VALUE] sqlstate_value

| condition_name

| SQLWARNING

| NOT FOUND

| SQLEXCEPTIONSee more……… http://dev.mysql.com/doc/refman/5.0/en/declare-handler.html

ENJOY WITH STUDY…..

NB: It is my understanding matters…if you doubt when check and clear it , then kindly send to me that mistake…………. [email protected]

Page 6: mysql ....question and answer by muhammed thanveer melayi

thanks and regards

Muhammed Thanveer . M