Primary key constraints
This constraint avoids duplication of rows and does not allow NULL values, when enforced in a column or set of columns. A a result it is used to identify a row. A table can have only one primary key. If a primary key constraint is assigned to more than one column(i.e) or combination of columns it is said to be a composite primary key (or simply a composite key), which can contain a maximum of 16 columns. Primary key constraint cannot be defined in an alter table command when the table contains rows having NULL values.
Run and Check your out put
- select * from emp;
- select deptno, dname, loc from dept;
- select empno, ename, salary, hiredate from emp;
- select ename,salary, salary+100 from emp;
- select ename, salary, (salary*12)+100 from emp;
- select ename,slary, (salary*12)+comm. from emp;
- select ename,salary, (salary*12)+nvl(comm,0) from emp;
- select ename “Full Name”, salary*12 “Annual Salary” from emp;
- select ename||job from emp;
- select ename||’ is a ‘||job “Emp Detail” from emp;
- select deptno from emp;
- select distinct deptno from emp;
- select distinct deptno, job from emp;
- In SQL, we can display the structure of a table using the DESCRIBE command. The command shows the column names and data types, as well as whether a column must contain data or not.
- desc emp;
- describe emp;
No comments:
Post a Comment