Table, View, Index, Sequence, Synonym. Flashcards
create database command
create database database_name;
query to use database
use database_name;
query to create table
create table table_name (table_name datatype (size) primary key,…);
query to insert values in database
insert into table_name values(val1,val2,…,valn);
display all elements of table
select * from student;
query syntax for creating view
create view view_name as
(
query
);
query for creating index after table creation
create index index_col_name on table_name
(
columns_names for index
)
creating index while table creation
create table table_name
(
col1 datatype (size)
col2 datatype (size)
.
index (col1,col2,…)
);
how to create synonym in mysql
we cannot create synonym in mysql
how to create synonym in oracle
create synonym synonym_name for table_name
syntax to create sequence in oracle
create sequence sequence_name
start with start_value
increment by value
minvalue value
maxvalue value
cycle/nocycle;
how to use sequence while inserting values into table in oracle
insert into table_name values (col_name.sequence_name,column2, column3 , ………)
how to take input from user while insertion in oracle
insert into table_name values(col1 , ‘&col2’,….)
how to create sequence in mysql
create table table_name (
col_name INT AUTO_INCREMENT PRIMARY KEY, —other columns
);
syntax to view index
show index from table_name;
note : compulsory index not index_name