Table, View, Index, Sequence, Synonym. Flashcards

1
Q

create database command

A

create database database_name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

query to use database

A

use database_name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

query to create table

A

create table table_name (table_name datatype (size) primary key,…);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

query to insert values in database

A

insert into table_name values(val1,val2,…,valn);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

display all elements of table

A

select * from student;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

query syntax for creating view

A

create view view_name as
(
query
);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

query for creating index after table creation

A

create index index_col_name on table_name
(
columns_names for index
)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

creating index while table creation

A

create table table_name
(
col1 datatype (size)
col2 datatype (size)
.
index (col1,col2,…)
);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how to create synonym in mysql

A

we cannot create synonym in mysql

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how to create synonym in oracle

A

create synonym synonym_name for table_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

syntax to create sequence in oracle

A

create sequence sequence_name
start with start_value
increment by value
minvalue value
maxvalue value
cycle/nocycle;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

how to use sequence while inserting values into table in oracle

A

insert into table_name values (col_name.sequence_name,column2, column3 , ………)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how to take input from user while insertion in oracle

A

insert into table_name values(col1 , ‘&col2’,….)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

how to create sequence in mysql

A

create table table_name (
col_name INT AUTO_INCREMENT PRIMARY KEY, —other columns
);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

syntax to view index

A

show index from table_name;

note : compulsory index not index_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how to use insert while inserting values in mysql by sequence

A

insert into table_name ( col_2, col_3, … ) values ( col2_value, col3_value);

16
Q

how to get inside sql in ubuntu terminal

A

sudo su
mysql -u root -p