Create Primary Key Using Alter Table Statement in Oracle

In my current company, besides SQL Server we also use Oracle. In terms of features and syntax, there is no significant difference between these two DBMS. For example, when we want to add primary key to existing database, we can use this Oracle PL/SQL command:

ALTER TABLE table_name 
ADD CONSTRAINT constraint_name PRIMARY KEY (column1, column2, ..., column_n);

As a side note, you cannot run this command if your existing data still contain duplication on the primary key. Thus, you must remove them first.

Git: Move Uncommitted Work to New Branch

Before we start making a change, chance is high that we are still in our master branch because this is the most current one. What if while debugging, we happen to change the code in this branch then realize it should be made in new branch. The solution is to run this command:

git checkout -b new_branch

This will bring all the changes to new branch. After this, it is easy to undo the changes that is already created in master later on.