HomeОбразованиеRelated VideosMore From: Manish Sharma

SQL tutorials 17: SQL Primary Key constraint, Drop primary Key

427 ratings | 97138 views
Blog link: http://www.rebellionrider.com/sql-primary-key.htm SQL tutorial on Primary key / SQL Primary key, In this tutorial you will learn about simple primary key, composute primary key, how to drop primary key. defining primary key using create table and alter table along with many other things. Tool used in this tutorial is SQL Developer. This tutorial series is part of SQL expert exam certification training. if you are preparing for SQL certification you can use my tutorials. This SQL Tutorial is a part of free training. Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=j7eYO7 Contacts E-Mail [email protected] Twitter https://twitter.com/rebellionrider Instagram http://instagram.com/rebellionrider Facebook. https://www.facebook.com/imthebhardwaj Linkedin. http://in.linkedin.com/in/mannbhardwaj/ Thanks for linking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com So Primary Key There are two types of Primary keys First is Simple primary Key: Primary key which Involves only one column and Second is Composite Primary Key: Primary Key which involves more than one column. We will start with Simple primary key. You can create Primary key either with Create Table statement of by using Alter table Statement. Let's define simple primary key using create table statements. With create table statement we can either define primary key at column level or at table level. We will start with defining Primary key at column level using create table statement. You just have to put keyword Primary key after data type and size of column while defining a column of a table. Here oracle server will create a primary key on product id with default constraint name which will be slightly difficult to understand. You can give your own name to your constraint which is also a good practice.
Html code for embedding videos on your blog
Text Comments (43)
yash kumar (2 months ago)
what will happen if create primary key later on the table column cust_id and if it contains the duplicate data?
shahbaz tamboli (2 months ago)
Hi manish thanks for the video. Can you please answer a question why do we have a need to enable and disable the primary key.?
Kwanza Henderson (3 months ago)
Hey man. Your videos are awesome. I'm studying for my Oracle 1Z0-071 certification test and your videos are helping me. I really appreciate you posting these helpful tutorials.
jhansi bode (3 months ago)
Could you please upload remaining constrains also check , defalut, unique
Abhishek Biswas (4 months ago)
Hey Manish, I would like to drop the existing PK constraint and newly create one on a table with a new set of columns, without removing it's existing data, is it possible?
janesh soni (4 months ago)
Excellent man....You are good at explaining......
Trishna Shukla (7 months ago)
Helo sir, can i add primary key to multiple columns without dropping existing primary key?
Jesus Salas (9 months ago)
Manish rocks!
coderz (10 months ago)
great work bro, I want to learn more from you. can you please teach me?
Jeevan Jyoti Katiyar (1 year ago)
Thanks Manish for these videos which is helping more & more. I need your help on how to use newID() function in Oracle.
Sɿiʞɒntʜ N (1 year ago)
This is done in toad application or other...?
Satyam Shukla (1 year ago)
Best video ever , excellent Manish..
YELALA ANURAG REDDY (1 year ago)
Error report - ORA-00911: invalid character 00911. 00000 - "invalid character" *Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual. when i try to execute this query CREATE TABLE customer  (   cust_id NUMBER(3) PRIMARY KEY,   cust_name  VARCHAR2(3),   phoneno  NUMBER(10),    ); anyone help please
Chris Gilchrist (1 year ago)
Question: Why must we drop the simple constraint PK before altering the table to add the composite.  In your example, when creating the table the composite constraint was in the DDL?
Kevin Tech (1 year ago)
One of the best tutorial class with all the details...Keep Going... Some Queries: 1.I created a table ,and I want to add Primary Key to a table 'Name'.but the name column have null and duplicate values,What should I do?? Can I add it if not what should I do,I dont want any other column as PK but name has the above issues. 2.Can You make a video on various level Certification on Oracle in detail...
hard reset (1 year ago)
ok sir good tutorial
prodipta mondal (1 year ago)
Error report - SQL Error: ORA-00955: name is already used by an existing object 00955. 00000 - "name is already used by an existing object" *Cause: *Action: for creating table this error is showing
Priyanka Raha (1 year ago)
Hi, my password has expired..pls let me know how to change it.reset password is disabled
Zohaib Khalid (2 years ago)
sir how to drop constraint on commosit primary key???
Zohaib Khalid (2 years ago)
+Manish Sharma if i drop only 1 constraint on a primary commosit key then ????
Manish Sharma (2 years ago)
+zohaib khalid I suggest you to read this blog on my website http://bit.ly/primary-key at the end of the article I explained how to drop a primary key constraint. Thanks Do make sure to share it with others
Zohaib Khalid (2 years ago)
plzzz upload Oracle Apps DBA Tutorials
Saurabh Saneja (2 years ago)
great!!
Basit Bhat (2 years ago)
Hello Manish, First of all I am a hug fan. It is incredible the way you simplify things. While going through this tutorial I didn't understand the concept of Composite Key. Because referring to the example you have shown here. I am still having duplicate values for phone number but unique values for customer id. please help...
Akshay Rokade (2 years ago)
best of luck for oracle 12c video i hope it will be awesome
Akshay Rokade (2 years ago)
thanks manish its very helpful for me
Simbu Jack (3 years ago)
thanks :))))
John Charles Halili (3 years ago)
thanks to this video, my semester will be saved
ajay kumar (3 years ago)
excellent job Manish .... this video is great and help me lot .... i really appreciate your work .... and thanks for this video .... thank you very much Ajay Kumar
jonathan tuftee (3 years ago)
great tutorial... Thanks for the effort
Sagar Mane (3 years ago)
thanks manish ,these all videos really help me lot......grt work !!
John Richardson II (3 years ago)
Manish you are great!!! I appreciate your tutorials
Saraswati Sahu (3 years ago)
Its really good,thanks  
Rajesh Bajjuri (4 years ago)
Boss simply superb all of this SQL videos...I loved it and instantly subscribed your channel. :) could you provide me real time scenarios..It would  helps a lot
Bunfire123 (4 years ago)
Extremely helpful, thank you!
Berk Can (4 years ago)
best in youtube even there are subtitles
Nitin Sharma (1 year ago)
Berk Can man, no one else in youtube is better than manish in this course. You are amazing bro
Manish Sharma (4 years ago)
+Berk Can Thanks :)
Lukus Cannon (4 years ago)
Thanks for the tutorial; Very confident delivery
sahil saini (3 years ago)
+Manish Sharma you r really doing aswn job bro, i m just following your tutorials
Manish Sharma (4 years ago)
+Lukus Cannon I am grateful for your positive feedback. Its a huge boost to my confidence. 
Deepti singh (4 years ago)
Hi Manish. Can you tell me the video number where you continued the character manipulation functions (starting from length)? Till video 13th I can see the explanation for substr. 
Manish Sharma (4 years ago)
I switched to Create table serial after video 13. Thanks for reminding, I will start working on rest of the CM functions soon. Thanks once again please subscribe.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.