From the course: Oracle Database 12c: Basic SQL

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Primary keys

Primary keys

- Constraints are ways for us to create rules on which data can be inserted into our table and which data should be rejected. Similarly to data types, which restrict the type of data that can be inserted into specific columns, constraints can extend these capabilities further. So let's see some examples of table constraints in action. For example, if we create a new table, such as create table demo_table2 and specify the first column with the name of column one, of type, number, and precision of five, we can specify that this is a primary key column. Primary key means that the database will enforce uniqueness for values inserted into this column. So no duplicate values can exist. So let's add another column, column two with the varchar two data type, giving it a precision of 20. Let's create our demo table and insert some rows. We'll start with the first row, insert into_demo_table2 values, and let's specify one as the…

Contents