Skip to main content

Featured post

How to Insert line break in Text component in React Native

Hi, I was developing an application in react native.I have to handle lots of text data in this small react native application.I have used  Text component in react native many times. While working on this application,i had a requirement to display some text content with line breaks.I will explain it clearly with an example.I want to display a text as shown below  Welcome Please subscribe my channel I wrote react native code as shown below <View> <Text> Welcome Please subscribe my channel </Text> <View> When i run these lines of code,It will display text as shown below Welcome Please subscribe my channel   - instead of displaying in two lines with line break,it displays in a single line.So i have to find a solution to insert line break in Text component in React Native.After lots of research,i found a clean solution as shown below <View> <Text> Welcome{"\n"} Please subscribe my channel </Text> <View> Here ...

Primary Key Violation explained with composite key

Hi friends,

We all know that there is an error which related to primary key of a table known as violation of primary key constraint.We can define primary key of a table with single column in the table.If you check below images it will be easy to understand.First i will explain primary key violation error with single column as primary of the table.

Create Table Employee with Id as Primary Key



Insert values into Employee Table




Select values from Employee Table



Now let us try to insert a new row , Id with value 1 as shown below picture 

Violation of Primary Key




So as shown in above image,When try to insert Id with value 1,then we will get violation of primary key error.Because of already there is an entry with Id=1 in the employee table


Now let us check what will happen if Primary key of table is a group of columns ,that means there is more that one column in the primary key of the table.I will explain it with images 


Create Employee Table with Composite Key




Insert values into Employee Table





Select Values from Employee Table




Now let us try to enter a new row whose  Id and Name having values which is already entered in the employee table.So we will get violation of primary key error in SQL Server Database


So i hope you understood how the primary key with single column or multiple column(Composite key) generates the violation of primary key error


Thanks