Explain Primary key, Composite key, and Foreign key with examples?
Attributes are the heading of columns in a table. In this table
Emp-ID, Aadhar-No, E-Name, Job, Salary, and Dept-No are the attributes, so there are six attributes.
![]() |
Different Keys in Database |
--------------------------------------------------
Other Topic of this Chapter
- Database
- Primary key / Foreign Key
- Create Database in Open Office Base
- Create Table in Open Office Base
- Update Table in Open Office Base
- Create Query in Open Office Base
- Creating Form in Open Office Base
- Report in Open Office Base
- DDL (Data Definition Language)
- DML (Data Manipulation Language)
-------------------------------------------------
What is Primary Key in a Table?
Primary Key is the field (Emp-ID,
E-Name etc) in a table which has unique values and doesn’t remain empty. It
helps to find records in a table. You can have only one Primary key in a table.
(SQL command for Primary key & Foreign key)
What is Composite Key in a Table?
Composite Key is one or more fields which have all the qualities of
Primary key. In above table Aadhar-No
is the composite key as it has unique values.
Sample Paper of Class 10
- English Sample Paper 2022 - 23
- Hindi A Sample Paper 2022 - 23
- Maths (Standard) Sample Paper 2022 - 23
- Maths (Basic) Sample Paper 2022 - 23
- Science Sample Paper 2022 - 23
- Social Science Sample Paper 2022 - 23
What is Foreign Key in a Table?
Foreign Key is a field in a table which setup a relationship among the
tables. In above table Dept-No is
the Foreign Key as it setup relationship between two tables.
What is Data Type in a Database? Explain different types of Data type.
Data Type is
the values that are going to be saved in a table. In above table Employee Name
will be Character, Salary will be Number.
These are the different types of Data in SQL:
Int: Integer data type holds positive and negative values without decimal.
Char(size): Character data type contains fixed length of characters. Its size doesn’t change according to the values, so it is defined with its size. Minimum and Maximum value for the size are 1 and 2000. Syntax: Char (5)
Varchar(size): Variable character data type as its length changes according to
its values. Minimum and Maximum value for the size are 1 and 4000. Syntax:
Varchar(20)
Float(size,d): Float data type represents decimal number for example: 234.55. In Float size defines number before decimal and d defines digits after decimal.
Date: Data type is used to save date and
time values. Format: DD: MM: RR
Chapter 1 – Digital Documentation
Chapter 2– Electronic Spreadsheet
Chapter 3 – Database Management System
Chapter 4 –Web Application
--------------------------------------------------
What is SQL? Explain DDL and DML Commands.
SQL Statements
SQL (Structured Query Language) developed by Oracle is a DBMS (Database Management System) which stores large amount of data. Youtube, Facebook, and Twitter all these companies use this DBMS to manage their data. SQL has many commands
1) DDL (Data Definition Language)
2) DML (Data Manipulation Language)
DDL (Data Definition Language)
DDL commands are subset of SQL commands. These commands are primarily used for defining and modifying the structure of a database or a table. These are the following commands used in DDL:
![]() |
DDL Commands in SQL |
1) Create command is used to create Database or a table.
2) Alter command is used to modify the structure of a database or a table.
3) Drop command is used to delete a database or a table.
4) Rename command is used to change the name of database or a table.
Chapter 1 – Digital Documentation
Chapter 2– Electronic Spreadsheet
Chapter 3 – Database Management System
Chapter 4 –Web Application
DML (Data Manipulation Language)
DML is the part of SQL and it is used for manipulating the data in a table. There basic commands are used to insert data, update, and get the record from the table. These are the following commands used in DML:
![]() |
DML Commands in SQL |
1) Insert command is used to enter the data in a table.
2) Select command is used to get the record from the table.
3) Delete command is used to delete the record from the table.
4) Update command is used to modify the information in a table.
Sample Paper of Class 10 IT 402
- Sample Paper 2020 - 21
- Sample Paper 2021 - 22
- Sample Paper 2021 - 22
- Sample Paper 2022 - 23
- Sample Paper 2022 - 23
No comments:
Post a Comment