The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
mysql ....question and answer by muhammed thanveer melayi
1. Keys
Keyisone or more fields/columnsindatabase table,itisusedtofetchor retrieve datafromtables
accordingto condition..
Super key
It isset of one or more keysused toidentifyarecordintable …example for….primarykey,alternative
key,unique key
Candidate key
It isset of one or more fields/columnsusedtoidentifyuniquelyarecordin a table….
Primary key
It isone or more field/columnsintable,usedtoidentifyarecorduniquelyin table.Itcannotacceptnull
valuesandduplicate values.If create aprimarykeywhencreate a index too….
Unique key
It isset of one or more fields/columnsusedtoidentifyuniquelyarecordin a table….itisaslike primary
key.But itaccept onlyone null value ,noduplicate values..
Alternative key
It isbasicallycandidate key..whileitmayperformasprimarykey
Composite /compound key
Combinationof more thanone fields/columns…itcanbe primarykeyor candidate key
Foreign key
2. It isa special fieldindatabase thatprimarykeyof anothertable.Itaccept multiplenull valuesand
duplicate values.
Joins
Joiniscombinationof rows intwo or more tables
Inner join
it will returnall rowswhichatleastone match inboth table..
left join
it returnall rowsfrom lefttable andmatchedtable fromrighttable
right join
it returnall rowsfrom righttable andmatchedrows fromlefttable
full join(sql)
returnall rows frombothtables
statements
data manipulation language(dml)
it isusedto store ,retrieve ,modify, delete andupdate dataindatabase……example:insert,delete.
Data definition language (ddl)
It isusedto create,modifythe structure of database objectindatabase.Example:create ,alter,
truncate,drop.
(we use delete whendelete the date onlybutstorage space isremind.Whileuse the truncate when
delete datawiththe storage space also. That meansitaffectedthe structure of table)
Data control language(dcl)
It isusedto givespermission,rolesandreferential integritytodatabase bysecuringit.itcanbe Grant or
Revoke .
Grand: it givesuser’saccessprivilegetodatabase
3. Revoke:itwithdrawaccessprivilege givenwithGrant command.
Syntax:
GRANT privilege_name
ON object_name
TO {user_name |PUBLIC |role_name}
[WITH GRANT OPTION];
Transaction control language(tcl)
It ismanage changesmade by DML statement…
Transaction
It isa logical unitof work thatcontainsone or more sql statementsindatabase. It mayCommitor
Role back…TRANSACTION make multiple changesin database , eitherthe changesare succeedwhen
the transactioniscommitted..if changesare undone whenitisrole back..
syntax
Start /begintransaction
Commit
Role back.
Store procedure
It isgroup of sql statementthatcreatedandstoredindatabase.It reduce networktrafficandincrease
performance.
It isfaster,reduce networktraffic,allowmodularprogramming( thatmeansonce create astore
procedure thencall itseveral time)
Syntax
Create procedure procedure_name
<parameter><data type>
( IN/OUT)
as
Begin
4. <bodyof procedure >
End
Call it withprocedure_name withparametervalue
Stored function
It isa special kindof stored programthat returna single value.
Normalization
It isa processwhere database isdesignedinawaythat reduce redundancy(duplicate values) and
increase the clarityof organizingdataindatabase…itreduce the usage of storage space and fast…
See more …. http://www.w3schools.in/dbms/database-normalization
View
It isa virtual table basedonresultsetof sql statement.Ithasrowsand columnslike real table ..viewdid
not take storage space and it issecure
Syntax
Create viewview_name
As
Selectcolumns_namesfromtable_name
Where condition
Index
It isusedto findrowswithspecifiedcolumnvaluequickly.
Syntax
Create index index_name
5. On table_name(column_name)
Cursor
It isvariable insql database..itisusedforrow by row operation.itisusedto fetchmultiplerows….
Syntax
Declare cursor_name cursor for select_statements
See more …. http://www.mysqltutorial.org/mysql-cursor
aggregative function
It isreturn single value whichcalculate fromvaluesincolumns …..ex:avg();count();sum()…..
scalar function
It isreturn single value basedonthe inputvalue………ex: Lcase;U case.
declare handler
It isspecifichandlerthateachmaydeal withone or more conditions.ifone of those conditionisoccur,
the specificstatementisexecuted..
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
6. | condition_name
| SQLWARNING
| NOT FOUND
| SQLEXCEPTION
See more………http://dev.mysql.com/doc/refman/5.0/en/declare-handler.html
ENJOYWITH STUDY…..
NB: It ismy understandingmatters…if youdoubtwhencheckandclearit, thenkindlysendtome that
mistake…………. muhammedthanveermelayi@outlook.com
thanks and regards
Muhammed Thanveer . M