Saturday, August 27, 2022

Data Types in Database Management System | Loksewa CAAN 078

 Q. Briefly describe the different data types used in the Database Management System. (5marks)

answer:
 Datatypes defines the domain of the columns in the table or variables in the code. They define whether the column or variable contains numbers, alphabets, Boolean values etc.
There are 6 inbuilt data types in DBMS. They are:

1. Scalar data types 

They are used to store the numeric column values or numeric variables. For example: If we have a column PHONE NO. in a table. This column can have only numbers in it. We cannot insert any date or alphabets into it. Hence we declare this column as NUMBER. This restricts the user while they try to insert any other values other than number. This is one of the mechanisms to maintain the domain constraint of a column.
It is subdivided into four types: Character, Numeric, Date/Time and Boolean.


2. Composite data types or User Define data types

Depending upon the need of the program, the programmer combines one or more datatype variables into form a one variable. This type of variables will have multiple same or different base datatypes defined in it. This type of datatypes is known as composite or user defined datatypes.
 For example, Record is one of the composite datatypes. It can have any number of datatypes within it

3.Reference data types
This datatype refers to the existing data in the program. It acts like pointers to the variable. One of the examples of reference datatype is refcursor. They are the cursor variables used to reference and access the static cursor. We can pass this variable to procedures / functions and get the values from function as a refcursor. In short it acts a variable, but reference to the query defined at the runtime.

4.LOB data types

These types of datatypes are used to store very large amount of data in a column / variable. It can store file like music, graphics etc. We have following types of LOB datatypes: BFILE, BLOB,CLOB, NCLOB

5.Unknown Column types

As we have seen this in the user defined datatypes to declare the variables. This is called unknown columns because this type of datatypes is not base datatypes and is defined by the user or tables. The programmer does not predict the datatype of it just by seeing name or declaration. S/He has to see the definition of record datatype to understand it. It is  subdivided as: %TYPE, %ROWTYPE, %ROWID.

6.User Define data types  

These datatypes are defined by the programmer while coding using the above base datatypes. They define new datatypes to ease their coding. This is can be considered as composite datatype too.

This is enough answer for 5 marks . For more than it, we can explain the subtypes with example.

Thank You ! Stay safe.

We will update more answers in coming days. Please do comment for any errors and mistakes. Provide us the suggestions, we will try to improve the answers.

@missionofficer

No comments:

Post a Comment

Featured post

Major Challenges for economic development of Nepal | Loksewa old Question Paper 2078

Q. Wha t do you mean by Economic Growth and Economic Development?  What are the main challenges of economic development of Nepal? Give your ...

Popular Posts