Anuj Dbms Ass 1
Anuj Dbms Ass 1
Solution:
• SQL was developed by IBM in 1970s for use in System R, it is an ISO and ANSI standard.
• Structured Query Language (SQL) is a language that provides an interface to relational
database systems.
• SQL is a computer language for storing, manipulating and retrieving data stored in relational
database.
• All relational database management systems like MySQL, Oracle, Sybase, Informix, postgres
and SQL Server use SQL as standard database language.
Features of SQL
• SQL can be used by a range of users, including those with little or no programming
experience.
• It is non procedural language.
• It reduces the amount of time required for creating and maintaining database systems.
• It is English like language.
Solution:
• DATE()
The date is displayed in YYYY-MM-DD format. This format is default for the DATE data type. The
DATE data type can store values from 0001-01-01 through 9999-12-31.
• CHAR(size)
CHAR is a fixed length string data type, so any remaining space in the field is padded with blanks.
CHAR takes up 1 byte per character. So, a CHAR(100) field (or variable) takes up 100 bytes on
disk, regardless of the string it holds.
• VARCHAR(size)
VARCHAR is a variable length data type, so it holds only the characters you assign to it. VARCHAR
takes up 1 byte per character, +2 bytes to hold length information. For example, if you set a
VARCHAR(100) data type=’Jen’, then it would take up 3 bytes (for J, E and N) plus 2 bytes, or 5
bytes in all.
• INTEGER
A 32-bit signed integer value. The range of INTEGER is -2147483648 to 2147483647. The int data
type is the primary integer data type in SQL server. The bigint data type is intended for use when
integer values might exceed the range that is supported by the int data type.
• NUMBER(p,s)
Number allows a decimal component whereas integer doesn’t. If you try to store 3.43 in an integer,
it will just store 3. Number allows for much larger values than integer does. p is a precision
value; s is a scale value.For e.g, number(6,2) is a number that has 4 digits before the decimal and
2 digits after the decimal.
Q3. Create table student with fields: Roll No. , Name, Course and Date of Birth and display its
structure.
Create table student123 (rollnonumber(10), name varchar(20), course varchar(30), dob date);
screenshot
Desc student123;
screenshot
Q4. Modify the structure of student table as follows(display structure after every modification):
Q5. Create table Employee with fields: EmpID, EmpName, Designation and Date of Joining
screenshot
Desc employee123;
screenshot
Q6. Modify the structure of Employee table as follows(display structure after every modification):