DBMS 10 Practical

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Maharishi Markandeshwar deemed to be University.

Name:- Raunak mishra Roll No. 11222619


Subject:- Database Management System Lab Course code:- BCSE-510L

Practical: - 10
Aim: - To implement convert functions and View statement in MySQL.
(A). now ():- It returns the current date and time as a string or numeric values.
Syntax: - select now ();

Fig 1.1

(B) char :- It converts value to char(a fixed length string).

Syntax: - select convert(‘any value’, char);

Fig 1.2
(C) time:- It converts value to time. Format is “HH:MM:SS”.
Date:- it converts value to date. Format is “yyyy-MM-DD.

Syntax:- select convert(‘HH:MM:SS’, time);

Fig 1.3

Syntax:- select convert(‘YYYY-MM-DD’, date);


Maharishi Markandeshwar deemed to be University.
Name:- Raunak mishra Roll No. 11222619
Subject:- Database Management System Lab Course code:- BCSE-510L

Fig 1.4

(D) signed:- It converts value to signed(a signed 64-bit integer).


Syntax: - select convert(8-9, signed);

Fig 1.5

(E) Unsigned:- It converts value to unsigned (an unsigned 64-bit integer).


Syntax: - select convert (8-9, unsigned);

Fig 1.6

Fig 1.6

(F) UTF 8:- UTF-8 is a variable width encoding that can be represent every character in the
Unicode character set.

Syntax: - select convert (string, using utf8);


Maharishi Markandeshwar deemed to be University.
Name:- Raunak mishra Roll No. 11222619
Subject:- Database Management System Lab Course code:- BCSE-510L

Fig 1.7

(G) latin1:- latin1 typically uses one byte per character.

Syntax:- select convert(string using latin1);

Fig 1.8

MySQL view:-

A view is a database object that has no values. Its contents are based on the base table. It
contains rows and columns similar to the real table. In MySQL, the View is a virtual
table created by a query by joining one or more tables.

(A). Create view:-

Syntax: - create view view_name as

select columns

from tables

where conditions;

Fig 1.9
Maharishi Markandeshwar deemed to be University.
Name:- Raunak mishra Roll No. 11222619
Subject:- Database Management System Lab Course code:- BCSE-510L

(B) Update view:-


Syntax:- alter view view_name as
select columns
from table
where conditions;

Fig 1.10
(C) Drop view:-
Syntax:- drop view view_name;

Fig 1.11
(D) MySQL create view with join clause.
Syntax:- create view view_name
As select columnNames
From table1, table2
Where conditions;
Maharishi Markandeshwar deemed to be University.
Name:- Raunak mishra Roll No. 11222619
Subject:- Database Management System Lab Course code:- BCSE-510L

Fig 1.12

You might also like