Additional Features of SQL are described below with examples.
SELECT DECODE ("column_name", "search_value_1", "result_1",Example: There is one table product_detail with fields prod_id and prod_name
["search_value_n", "result_n"],
{"default_result"} );
SELECT DECODE (prod_name, 'shoes', 's', 'belts', 'b') `prod_id` FROM product_detail;
CREATE TABLE TABLE_NAME (PRIMARY_KEY_COLUMN INT PRIMARY KEY IDENTITY ( [Initial_Value], [Interval] ), ...);Example: We are going to create a table named customer with fields ID, NAME, AGE in which the ID is primary key and auto incremented field.And when we insert value.
CREATE TABLE TABLE_NAME (PRIMARY_KEY_COLUMN INT PRIMARY KEY IDENTITY ( [Initial_Value], [Interval] ), ...);Example: Create a table named customer with fields ID, NAME, AGE in which the ID is primary key and given identity start from 2. And when we insert value then it will start the auto increment from 2.
CREATE TABLE customer (id int PRIMARY KEY IDENTITY(2,1), name nvarchar(50), age int);
CREATE SEQUENCE SEQUENCE_NAME [START WITH {Initial_Value}] [INCREMENT BY {interval}];Example: We have created a table user_detail with fields userid, username, age
CREATE SEQUENCE SEQ_USER START WITH 5 INCREMENT BY 10;
INSERT INTO user_detail values (SEQ_USER.NEXTVAL, 'JOHN', 45)
INSERT INTO user_detail values (SEQ_USER.NEXTVAL, 'SAM', 41)
Table Name:user_detail
ID | User Name | Age |
---|---|---|
10 | JOHN | 45 |
20 | SAM | 41 |
<div style="clear:both"><a href="https://www.assignmenthelp.net/assignment_help/differences-between-mssql-and-mysql"> <img src="https://www.assignmenthelp.net/files/difference-between-mssql-and-mySQL.jpg" title="difference-between-mssql-and-mySQL" alt="difference-between-mssql-and-mySQL" border="0" /></a></div> <div>Courtesy of: <a href="https://www.assignmenthelp.net/assignment_help/differences-between-mssql-and-mysql">AssignmentHelpNet</a></div>
Assignment Writing Help
Engineering Assignment Services
Do My Assignment Help
Write My Essay Services