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:

GitHub repository using Git Bash command

  To add a project to a GitHub repository using Git Bash command line, you can follow these steps: Create a new repository on GitHub by logg...