Wednesday, November 22, 2017

What is sql injection ? ( top interview Question)

What is sql injection ?

SQL injection is a code injection technique that might destroy your database.
SQL injection is one of the most common web hacking techniques.
SQL injection is the placement of malicious code in SQL statements, via web page input.


What is the difference between primary key and unique key ?
Primary Key
Unique Key
Definition
Primary key is a type of a unique key. This is the key that is allowed to migrate to other entities to define the relationships that exist among the entities.
A unique key is a set of zero, one, or more attributes. The value(s) of these attributes are required to be unique for each tuple (row) in a relation. The value, or combination of values, of unique key attributes for any tuple should not be repeated for any other tuple in that relation.
Used in
Relational Database Management Systems such as MySQL, Oracle, etc.
Relational Database Management Systems such as MySQL, Oracle, etc.
Null Values
Does not accept any null values
Accepts only one null value in the table
Type of Index
Is a clustered index and data in the database table is physically organized in the sequence of clustered index           
Is a unique non-clustered index
Number of Keys allowed
Only one primary key in a table
Can have more than one unique key in a table
Convertible
Can be made into a foreign key into another table
Can be made into a foreign key into another table

What is the difference between char and varchar  ?
CHAR Data Type is a Fixed Length Data Type. For example if you declare a variable/column of CHAR (10) data type, then it will always take 10 bytes irrespective of whether you are storing 1 character or 10 character in this variable or column. And in this example as we have declared this variable/column as CHAR(10), so we can store max 10 characters in this column.
On the other hand VARCHAR is a variable length Data Type. For example if you declare a variable/column of VARCHAR (10) data type, it will take the no. of bytes equal to the number of characters stored in this column. So, in this variable/column if you are storing only one character then it will take only one byte and if we are storing 10 characters then it will take 10 bytes. And in this example as we have declared this variable/column as VARCHAR (10), so we can store max 10 characters in this column.
if you like our post you can contribute us by Click Here

1 comment:

  1. CIIT Noida provides Best MCA Courses in Noida based on the current IT industry standards that help students to get high paying jobs in Top MNCs. CIIT provides Best MCA Training in Noida, Greater Noida, and Ghaziabad. CIIT is one of the trusted MCA training institutes in Noida providing practical knowledge and 100% job assistance with basic as well as advanced level MCA subjects. CIITN is the best MCA college in Noida, greater noida, ghaziabad, delhi, gurgaon regoin.

    At CIIT MCA classes in Noida is conducted by subject experts corporate professionals with 9+ years of experience in managing real-time and live projects. Sofracle Nano Specialized MCA classes Noida is the perfect blend of academic learning and practical sessions to provide maximum exposure to students that transform an average student into a corporate professional whom companies prefer to hire.

    Best MCA College in Noida

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...