Introduction to Database Management System

Chapter 3 · Tamil Nadu State Board

  • 23 min read
  • 6-question quiz

Every key point below shows the sentence from your textbook it comes from. How we check content

In short

This lesson explains how DBMS stores, organizes, protects and manages data, including through tables and relational databases. It introduces database models, keys, ER diagrams and the roles of database administrators. It also teaches how MySQL and SQL are used to create and manage databases, tables and records. These ideas matter because careful database design and suitable commands help people retrieve, update and protect information.

Written by AI from this lesson. How we check it

Key points

  • A DBMS is software that helps users create databases and manage their data.
    From your textbook
    “The DBMS provides users and programmers with a systematic way to create, retrieve, update and manage data.”
  • Database systems became popular because file systems could duplicate data, cost more to maintain and provide less security.
    From your textbook
    “So database systems became popular to overcome the above limitations of file system.”
  • ACID properties address reliable transactions, while locking helps control shared data access.
    From your textbook
    “The acronym stands for Atomicity, Consistency, Isolation and Durability.”
  • In a relational model, a table contains rows and columns, with each row representing a record and each column an attribute.
    From your textbook
    “The vertical entity in a table is known as Attribute or Column.”
  • A primary key uniquely identifies a row, while a foreign key represents a relationship by copying a parent primary key.
    From your textbook
    “A foreign key is a “copy” of a primary key that has been exported from one relation into another to represent the existence of a relationship between them.”
  • ER models describe entities, their attributes and the relationships connecting them.
    From your textbook
    “The basic concepts of ER model consists of”
  • SQL commands have different purposes, such as defining structures, changing data, retrieving results and controlling permissions.
    From your textbook
    “SQL commands are classified into five major categories depending on their functionality.”
Test yourself: 6 questions

Formulas in this chapter

  • INSERT query syntaxINSERT INTO table name (Parameter1,Parameter2, Parameter3..) VALUES (Value1, Value2, Value3..);Explained here
  • Insert rowsINSERT INTO TABLE_NAME (column1, column2, column3, ... columnN) VALUES (value1, value2, value3, ...valueN);Explained here

Database Management System (DBMS)

Definition

Database
A database is a place to store, retrieve and manage related data.

Definition

Database Management System (DBMS)
A DBMS is system software that helps users and programmers create, retrieve, update and manage databases.

A DBMS manages data through actions such as storing, retrieving and filtering. It groups related data in a table, which helps identify where the data is stored. MySQL and Oracle are examples of DBMS.

Limitations of file systems

  • Data duplication: The same data may be copied for use by different resources, wasting space.
  • High maintenance: Controlling access and checking data consistency require high maintenance cost.
  • Security: File systems provide less security for data.

Remember: Database systems became popular to overcome file-system limitations such as duplication, high maintenance and low security.

ACID Properties and Concurrency Control

ACID properties

  • Atomicity: An update follows “All or Nothing.” A transaction either commits successfully or aborts when it fails.
  • Consistency: Data values remain consistent after changes.
  • Isolation: Concurrent transactions are separated and serialized to prevent conflicts.
  • Durability: The system can recover committed transactions after storage or system failure.

Definition

Transaction
A transaction is an operation that updates data in a database.

Definition

Concurrent transaction
A concurrent transaction happens when multiple users access the same object and perform transactions at the same time.

Concurrency Control is the DBMS mechanism for sharing data. Locking controls who has the privilege to change a data item when it is shared among users.

Transaction outcomes

CommitsAborts
The update succeeds.The update fails.

Hierarchical and Network Database Models

The Hierarchical database model arranges records in parent-child relationships like a tree. Record types are equivalent to tables in the relational model, and individual records are equivalent to rows.

Hierarchical and Network models

Hierarchical modelNetwork model
Each record has a parent-child relationship.Each member can have more than one owner.
Advantages include less redundant data, efficient search, data integrity and security.Handles many-to-many relationships better and supports easy data access, data integrity and independence.
Complex to implement; difficult to handle many-to-many relationships.Difficult to design and maintain.

The first developed network data model was IDS (Integrated Data Store) at Honeywell. Its three components are Network schema, Sub schema and Language.

Network model components

  • Network schema defines the database structure.
  • Sub schema controls the user’s views of the database.
  • Language provides the basic procedure for accessing the database.

Relational and Object-oriented Database Models

Definition

Relational model
A relational model represents data using tables made up of columns and rows.

Relational model terms

  • Instance: A table consisting of rows and columns.
  • Schema: The structure of the database, including each column’s name and type.
  • Relation: A table with unique attributes (columns) and tuples (rows).

Oracle and DB2 are commercial relational models in use. The object-oriented database model combines Object Oriented Programming (OOP’s) concepts with database technologies and uses small, reusable software called Objects.

Relational and object-oriented models

Relational modelObject-oriented database model
Organizes data as tables with columns and rows.Stores reusable Objects in an object oriented database.
Uses instances and schemas to describe tables and their structure.Efficiently manages many different data types and complex behaviors.

Remember: In a relational table, attributes are columns and tuples are rows.

Relational Database Management System

Definition

Relational Database
A database whose logical organization uses the relational data model is called a Relational Database.

Definition

RDBMS
A DBMS that manages a Relational Database is called a Relational Data Base Management System.

RDBMS is the basis for SQL and modern database systems such as MySQL, oracle and Microsoft Access. Its basic concepts include databases, tables, tuples, attributes, schemas and keys.

Features of RDBMS

  • High Availability
  • High Performance
  • Robust Transactions and support
  • Ease of management
  • Less cost

MySQL is a popular open source SQL database. It supports Windows, Linux and MAC Operating Systems. Other relational databases include Oracle, MS SQL Server and MS Access.

Tables, Columns, Rows and Keys

Definition

Table
A table is a collection of data arranged in rows and columns.

A table is a simple way to represent relations. Unlike a true relation, a table can contain duplicate rows. The Employee table has the attributes ID, NAME, AGE and SALARY.

Parts of a table

PartMeaning
Column or AttributeA vertical part of a table that holds values of the same type. The set of allowed values is its Attribute Domain.
Row, Record or TupleA horizontal entry that represents a set of related data.

For example, the Name field in the Employee table holds characters, not numbers. One row in that table is 1, Alex, 26, 22,000.

Definition

Primary key
A candidate key chosen to identify rows is the primary key, and each tuple must have a unique value for it.

Definition

Alternate key
A candidate key that is not chosen as the primary key is an alternate key.

Definition

Super Key
An attribute or group of attributes that can distinguish every tuple from every other tuple in a relation is a Super Key.

Definition

Candidate key
A candidate key is a minimal super key, selected without redundant attributes.

Definition

Composite key
A key with more than one attribute that identifies table rows uniquely is a Composite key, also called a Compound Key.

Definition

Composite primary key
A primary key made from more than one attribute is called a composite primary key.

Definition

Foreign key
A foreign key is a copy of a parent primary key placed in another relation to show a relationship between them.

Foreign key facts

  • A foreign key copies the whole parent primary key.
  • If the primary key is composite, the foreign key is also composite.
  • Foreign key values usually do not need to be unique, and they can be null.
  • A composite foreign key cannot have some attributes null and others non-null.

Remember: A primary key uniquely identifies a tuple. A foreign key represents a relationship by copying a parent primary key into another relation.

ER Model and Entities

Definition

ER model
An ER model represents a database design using real-world entities and the relationships, conditions and dependencies between them.

Basic concepts of an ER model

  • Entity or Entity type
  • Attributes
  • Relationship

Definition

Entity
An entity is an easily identifiable real-world object or animation.

Employee, HR and Manager can be entities in a company’s database. Each entity can have its own attributes. An entity is represented by a rectangular box.

Types of entity

TypeMeaning and representation
Strong EntityDoes not depend on another entity and has a primary key. It is represented by one rectangle.
Weak EntityDepends on other entities and does not have its own primary key like a Strong Entity. It is represented by a double rectangle.
Entity InstanceA value or example belonging to an entity category.

Marks is an example of a weak entity because it has no unique id or primary key and depends on another entity. Examples of entity instances include Male and Female for Human, and Dog, cats and lion for Animals.

More entity instance examples

  • Jobs: Engineer, Doctor, Lawyer
  • Actors: Ajith, Vijay, Vikram
  • Electronics: Laptop, Mobile

Attributes and Their Types

Definition

Attribute
An attribute is information about an entity that describes, quantifies, qualifies, classifies or specifies it.

An attribute always has a single value, which can be a number, character or string. The listed attribute types are Key Attribute, Simple Attributes, Composite Attributes, Single Valued Attribute and Multi Valued Attribute.

Definition

Key Attribute
A Key Attribute describes a unique characteristic of an entity.

Definition

Simple Attribute
A Simple Attribute cannot be separated and has a single value for an entity.

Name is an example of a Simple Attribute for the Employee entity. It is treated as one value and cannot be separated.

Remember: An attribute describes an entity; a key attribute identifies a unique characteristic, while a simple attribute cannot be split.

Composite, Single-Valued and Multi-Valued Attributes

Definition

Composite attribute
An attribute that can be divided into simple attributes without changing its meaning.

For an employee, Name can be a composite attribute. It can be divided into first name and last name.

Definition

Single-valued attribute
An attribute that contains only one value for an entity.

Examples of single-valued attributes

  • Age: one person has one age value.
  • Roll no: one roll number value.

Definition

Multi-valued attribute
An attribute that can contain more than one value for an entity.

Examples of multi-valued attributes

  • Degree: a person may have B.Tech, MBA.
  • Bank_Account: a person may have SBI, HDFC.

Attribute types

TypeWhat it means
CompositeCan be divided into simple attributes.
Single-valuedHas one value.
Multi-valuedHas more than one value.

Relationships, Relationship Instances and Degree

Definition

Relationship
A connection that exists between entities in an ER Model.

Types of relationships

TypeConnection between entities
One-to-One (1:1)One instance of A is associated with 0 or 1 instance of B, and one instance of B is associated with 0 or 1 instance of A.
One-to-Many (1:N)One instance of A can be associated with 0 or 1 or many instances of B. One instance of B is associated with 0 or 1 instance of A.
Many-to-Many (M:N)One instance of A can be associated with 0 or 1 or many instances of B, and one instance of B can be associated with 0 or 1 or many instances of A.

One-to-one relationships are used less often. One-to-many and many-to-many relationships are commonly used. In relational databases, many-to-many relationships are converted into one-to-many relationships.

Definition

Relationship instance
A tuple showing a particular connection between entities; relationship instances in RDBMS systems do not have duplicates.

For example, Ram works for the Comp.sc department and Shyam works for the electrical department are instances of the Works-for relationship between Employee and department.

Definition

Degree of a relationship
The number of entity types involved in a relationship.

Relationship degree types

  • Unary: one entity type. Manager-of connects an employee entity to itself.
  • Binary: two entity types. Employee works-for department connects two entities.
  • Ternary: three entity types. A customer purchasing an item with a shop keeper involves three.

Cardinality in ER Models

Definition

Cardinality
The number of items included in a relationship, showing how entities in one set are mapped to entities in another set.

Cardinality types and examples

TypeExample
One-to-OneA person drives a vehicle.
One-to-ManyA customer can place multiple orders, and each order is related to only one customer.
Many-to-ManyA student can register for more than one course, and a course can be registered by many students.

Remember: Cardinality describes how many entities on one side of a relationship connect to entities on the other side.

ER Diagrams and MySQL

An ER Diagram shows data visually and shows how the data are related. Its components are entities, attributes and relationships, each represented with specific symbols.

ER Diagram notations

  • Strong entity: simple rectangular box.
  • Weak entity: double rectangular boxes.
  • Strong relationship between entities: rhombus symbol.
  • Weak relationship: rhombus within rhombus.
  • Attribute: ellipse connected to the entity.
  • Key attribute: underline the attribute name inside the ellipse.
  • Derived attribute: dotted ellipse inside the main ellipse.
  • Multivalued attribute: double ellipse.

The School Management System example includes Parent, student, Admin, Teacher, class and subjects. Its relationships include Parent HAVE Student, Admin ENROLLS Student, Admin HIRES Teacher, Admin ADDS Subject, Teacher TEACHES Subject and Teacher IS ASSIGNED TO Class.

Attributes shown in the school example

  • Parent: Name, Id, Fname, Lname.
  • Student: Id, Name, Fname, Lname.
  • Teacher: Name, Id, Phone#, Address.

Definition

Database
A structured collection of data.

Definition

SQL
Structured query language, a standardized language used to access a database and process data into efficient information.

Definition

MySQL
An open source relational database management system that allows relational databases to be managed.

MySQL lets users change its source code to meet their needs. It runs on platforms such as Windows and Linux, and is described as scalable, reliable and fast. Its name combines “My” and “SQL”.

Remember: SQL is a language for accessing databases; MySQL is a relational database management system.

Web Databases

Databases are grouped as Heavy and Light databases. Heavy databases support desktop applications, while Light databases support web applications and handle network issues more efficiently. Light databases that support web applications are also called Web Databases.

Commonly used databases

  • DB2
  • MySQL
  • Oracle
  • PostgreSQL
  • SQLite
  • SQL Server
  • Sybase

Remember: MySQL is the most commonly used database in the world due to its ease of use.

MySQL Database Administrator and User Privileges

Definition

Database Administrator (DBA)
A Database Administrator takes care of database configuration, installation, performance, security and data backup.

A DBA needs skills in database design, database queries, RDMS, SQL and networking. One main task is creating users and giving them access rights. A new MySQL account must have an entry in the user table.

The INSERT query adds a new user's details and privileges to the user table. The example gives the guest account INSERT, SELECT and UPDATE rights. After creating an account, run FLUSH PRIVILEGES so the server updates the account and its access rights.

INSERT query syntax

INSERT INTO table name (Parameter1,Parameter2, Parameter3..) VALUES (Value1, Value2, Value3..);

table name is the table to add a record to; Parameters are the fields, and Values are the data entered for those fields.

SQL queries end with a semicolon (;). The PASSWORD() function encrypts the password before it is stored. In the example, ‘guest123’ is stored as ‘j2gd6vxd1bj3k13g4’.

Access flags and privileges

FlagMeaning
YAccess is granted.
NAccess is denied.

MySQL privileges

  • Select_priv: select rows from database tables.
  • Insert_priv: insert rows into database tables.
  • Update_priv: update rows of database tables.
  • Delete_priv: delete rows from database tables.
  • Create_priv: create new tables in the database.
  • Alter_priv: make changes to the database structure.

Remember: Run FLUSH PRIVILEGES after creating each new account so its account details and access rights are updated in the server.

Administrative MySQL Commands

Commands and what they do

CommandPurpose
USE DatabaseSelects the database to work with.
SHOW DatabasesLists the databases available on the database server.
SHOW TablesLists the tables in the current database.
SHOW COLUMNS FROM tablenameShows a table's attributes, types, null settings, key information, default values and other information.
SHOW INDEX FROM tablenameShows the indexes for a table.
SHOW TABLE STATUS LIKE tablename\GProvides a detailed report on a table's performance.

For example, use ‘use test;’ to select test as the working database. Commands such as ‘show tables;’ and ‘show columns from sports;’ display information about the current database and its tables.

Installing and Opening MySQL with XAMPP

Installation and access steps

  • Download and install XAMPP Server Software.
  • In the setup, choose the required components, including MYSQL.
  • Choose the installation folder and continue through the setup.
  • When installation finishes, open the XAMMP Control panel.
  • Start the Apache and MySQL Services one by one.
  • Open http://localhost/phpmyadmin in a browser to access the MySQL database.

Remember: Start both Apache and MySQL Services in the XAMMP Control panel before opening the MySQL database through the browser.

MySQL Administration Tools

Open source tools help people design and manage databases. PhpMyAdmin is a popular web administration tool. MySQL Workbench and HeidiSQL are desktop applications.

MySQL tools and their uses

ToolMain uses
PhpMyAdminA web application written in PHP. It provides a web interface, imports data from CSV, exports data to different formats, displays live charts of server activity
MySQL WorkbenchA desktop tool mainly used by developers and DBA’s for visualization, data modeling, SQL development, server configuration, and backup. Its SQL editor can handl
HeidiSQLAn open source desktop tool with GUI features for monitoring server hosts, connections, Databases, Tables, Views, Triggers, and Events.

Remember: Remember: PhpMyAdmin is a web tool; MySQL Workbench and HeidiSQL are desktop tools.

Database Design and Its Main Parts

Definition

Database design
Database design is the process of creating, implementing, and maintaining enterprise data in a system.

A good design starts with understanding what the application needs. The first phase is conceptual design, where the required databases, tables, columns, and data types are discussed. The resulting model is planned to meet the end user’s expectations.

Main parts of a database

  • Tables contain rows and columns. Each row is a record, and each column is an attribute.
  • Queries ask questions with conditions. The database returns records that satisfy those conditions.
  • Views are sets of stored queries.

Create tables to match the functions in an application. For example, an online shopping site can have Customer, Products, Order, and Payment tables. Choose columns that hold the needed information, and assign an appropriate value type to each column.

Worked example

Create and select a database named personaldetails, then display the database list.

Try it first, then show the solution
  1. Run: mysql> create database personaldetails;
  2. The result is: Query Ok, 1 row affected
  3. Run: mysql> USE personaldetails;
  4. The result is: Database changed
  5. Run: mysql> show databases;

Answer: The database list includes employee, personaldetails, and sports.

Insert rows

INSERT INTO TABLE_NAME (column1, column2, column3, ... columnN) VALUES (value1, value2, value3, ...valueN);

TABLE_NAME is the table receiving the row. The column names identify where values are placed, and each value supplies data for its matching column.

SQL and Its Main Uses

Definition

SQL
SQL, or Structured Query Language, is a standard language used to access and manipulate databases.

SQL is declared as a standard by American National Standards Institute (ANSI) and International Organization for Standardization (ISO). Different versions are maintained to meet different requirements.

What SQL can do

  • Execute queries against a database and retrieve data.
  • Insert, update, and delete records.
  • Create databases and tables.

Remember: Remember: SQL commands are grouped into five categories according to what they do.

Five Categories of SQL Commands

SQL command categories

CategoryPurpose and commands
Data Definition Language (DDL)Defines or changes database structure. CREATE creates databases or tables; ALTER modifies structure; DROP deletes a database or table; RENAME changes an object’
Data Manipulation Language (DML)Works with data in the database. INSERT adds rows; UPDATE changes existing data; DELETE removes records.
Data Query Language (DQL)SELECT retrieves data from a table.
Transaction Control Language (TCL)Manages transactions and saving changes. COMMIT saves permanently; ROLLBACK restores the database to its form since the last COMMIT; SET TRANSACTION sets transa
Data Control Language (DCL)Controls permissions on database objects. GRANT gives permissions to specific users; REVOKE takes permissions away.

Remember: For revision, connect each category with its job: DDL defines structure, DML changes data, DQL retrieves data, TCL manages transactions, and DCL controls permissions.

Creating, Removing, and Selecting a Database

CREATE makes a new database. DROP removes an existing database. USE selects a database so you can work with it.

Database commands

  • CREATE database databasename; creates a database.
  • Show databases; lists the databases.
  • DROP database databasename; removes a database.
  • USE databasename; selects a database.

Worked example

Create and select the studentDB database.

Try it first, then show the solution
  1. CREATE database studentDB;
  2. USE studentDB;

Answer: studentDB is created and selected.

Adding, Retrieving, Deleting, and Updating Records

A table stores records in rows and fields in columns. INSERT adds a new record. SELECT retrieves records, and UPDATE changes existing records.

Record commands

  • INSERT INTO tablename (column1, column2, column3) VALUES (value1, value2, value3); adds values to named columns.
  • INSERT INTO tablename VALUES (value1, value2, value3); adds values without naming the columns.
  • SELECT * from tablename; retrieves all columns.
  • SELECT column1, column2 from tablename; retrieves only the named columns.
  • UPDATE tablename SET column1=”new value” Where column2=”value2”; changes a value for records matching the condition.

Worked example

Change Krishna’s age in Biodata to 13.

Try it first, then show the solution
  1. Use UPDATE to change a value in an existing record.
  2. Use WHERE firstname=”Krishna” to identify the record.

Answer: UPDATE Biodata SET age=13 WHERE firstname=”Krishna”;

Definition

WHERE clause
The WHERE clause sets a condition for selecting or modifying records.

DELETE removes records from a table. With a WHERE condition, it removes records that match the condition. Without a WHERE condition, it deletes all data from the table.

DELETE command forms

CommandEffect
DELETE from tablename WHERE columnname=”value”;Deletes records matching the condition.
DELETE from tablename;Deletes all data from the table.

Conditions, Operators, and Sorting

WHERE sets the criteria used to select or modify data. The number of records updated depends on the condition. ORDER BY sorts query results in ascending order by default; adding DESC sorts them in descending order.

Operator types

  • Arithmetic Operator: +, -, *, /, %
  • Comparison Operator: =, !=, <, >, <>, >=, <=,
  • Logical Operator: AND, ANY, BETWEEN, EXISTS, IN, LIKE, NOT, OR, UNIQUE

Worked example

Sort Biodata by firstname in descending order.

Try it first, then show the solution
  1. Use ORDER BY followed by the column name.
  2. Add DESC for descending order.

Answer: select * from Biodata ORDER BY firstname DESC;

Grouping Records, Joining Tables, and Database Terms

GROUP BY puts records with the same value into groups. SUM(Marks) adds the marks in each group. A JOIN retrieves data from tables by using columns with matching values.

Worked example

Group exam marks by Rollno and show the total marks.

Try it first, then show the solution
  1. Group the records by Rollno.
  2. Use SUM(Marks) to add marks in each group.

Answer: Select Rollno, SUM(Marks) from Exams GROUP BY Rollno;

Worked example

Show each profile name and hobby with the total exam marks for the matching Rollno.

Try it first, then show the solution
  1. Use Profile and Exams as the tables.
  2. Match the tables with Profile.Rollno = Exams.Rollno.
  3. Group by Profile.Name and Profile.Hobby, and add Exams.Marks.

Answer: SELECT Profile.Name, Profile. Hobby, SUM(Exams.Marks)As Total FROM Profile, Exams WHERE Profile.Rollno = Exams.Rollno GROUP BY Profile.Name, Profile.Hobby;

Definition

Primary Key
A key that identifies each record in a relational table uniquely.

Definition

Relationship
A relationship exists when the foreign key of one table references the primary key of another table.

Definition

Cardinality
The number of different values in a table column.

Definition

Backup
A program or process that copies table contents into a file for future reference.

Definition

SQL
Structured query Language is a programming language designed mainly for managing data in RDBMS.

Definition

Record
A record in a table is composed of fields.

Definition

Query
A query is an SQL command executed against databases.

Definition

Join
A Join retrieves data from two or more tables by referencing columns that hold identical values.

Definition

Open source
Open source refers to a design that is publicly accessible for modification and sharing.

Remember: Use WHERE to limit which records are selected, deleted, or updated. Without WHERE, DELETE removes all data from the table.

Questions students ask

Short, direct answers to what students search for in this chapter.

What is a DBMS?

A DBMS, or Database Management System, is system software for creating and managing databases. It gives users and programmers a systematic way to create, retrieve, update and manage data.

What are the ACID properties in DBMS?

ACID stands for Atomicity, Consistency, Isolation and Durability. Atomicity means an update either succeeds or fails as a whole. Consistency keeps data values consistent. Isolation separates concurrent transactions, and Durability helps recover committed transactions after a failure.

What is the difference between hierarchical and network database models?

The hierarchical model arranges records in parent-child relationships like a tree. In the network model, a member can have more than one owner. The network model handles many-to-many relationships better, while both models have difficulties with design or implementation.

What are instance and schema in the relational model?

In the relational model, an instance is a table made up of rows and columns. A schema specifies the database structure, including the name and type of each column. A table’s columns are attributes, and its rows are tuples.

What is an object-oriented database model?

An object-oriented database model combines Object Oriented Programming (OOP’s) concepts with database technologies. It stores small, reusable software called Objects. This model manages many different data types and handles complex behaviors efficiently.

What is the difference between a row and a column in a database table?

A column, also called an attribute, is a vertical part of a table and holds values of the same type. A row, also called a record or tuple, is a horizontal entry that contains a set of related data.

Show 24 more questions

What is a primary key in an RDBMS?

A primary key is a candidate key chosen to identify rows in a relation. Every tuple must have a unique value for its primary key, so it can be distinguished from other tuples.

What is a foreign key and what does it do?

A foreign key is a copy of a parent primary key placed in another relation. It represents a relationship between the relations. Its values usually do not need to be unique, and they can be null.

What is the difference between a strong entity and a weak entity?

A strong entity does not depend on another entity and has a primary key. A weak entity depends on other entities and does not have its own primary key like a strong entity. A strong entity uses one rectangle; a weak entity uses a double rectangle.

What is a simple attribute in database design?

A simple attribute cannot be separated and has a single value for an entity. Name is an example for the Employee entity. The listed attribute types also include Key Attribute, Composite Attributes, Single Valued Attribute and Multi Valued Attribute.

What is the difference between single-valued and multi-valued attributes?

A single-valued attribute contains only one value for an entity, such as Age or Roll no. A multi-valued attribute contains more than one value, such as Degree with B.Tech, MBA or Bank_Account with SBI, HDFC.

What are the three types of relationships in an ER Model?

The three types are one-to-one (1:1), one-to-many (1:N) and many-to-many (M:N). They describe how instances of two entities are connected. For example, a customer placing multiple orders is one-to-many.

What does degree of a relationship mean?

The degree of a relationship is the number of entity types involved. A unary relationship involves one entity type, a binary relationship involves two, and a ternary relationship involves three.

What is cardinality in an ER Model?

Cardinality is the number of items included in a relationship. It shows how entities in one set are mapped to entities in another set. Its classifications are one-to-one, one-to-many and many-to-many.

What is MySQL and how is it different from SQL?

MySQL is an open source relational database management system for managing relational databases. SQL, or structured query language, is a standardized language used to access databases and process data. So, MySQL is a system, while SQL is a language.

What is a Web Database?

A Web Database is a Light database that supports web applications. Light databases handle network issues more efficiently than Heavy databases, which support desktop applications.

What does a MySQL Database Administrator do?

A Database Administrator takes care of database configuration, installation, performance, security and data backup. A main task is creating new users and assigning their access rights.

What does FLUSH PRIVILEGES do in MySQL?

FLUSH PRIVILEGES updates the server with a newly created account and its access rights. It is run after creating a new account, avoiding the need to reboot the server manually.

What are the main administrative MySQL commands?

USE selects a database. SHOW Databases lists databases, and SHOW Tables lists tables in the current database. SHOW COLUMNS displays table details, SHOW INDEX displays indexes, and SHOW TABLE STATUS provides a performance report.

How do I access MySQL after installing XAMPP?

Open the XAMMP Control panel and start the Apache and MySQL Services one by one. Then open http://localhost/phpmyadmin in a browser to access the MySQL database.

What are the main MySQL administration tools?

The main tools are PhpMyAdmin, MySQL Workbench, and HeidiSQL. PhpMyAdmin is a web administration application. MySQL Workbench and HeidiSQL are desktop applications used for database work and administration.

What is conceptual design in database design?

Conceptual design is the first phase of database design. It discusses the databases, tables, columns, and data types needed for an application. The resulting model is planned to meet the expectations of the application’s end user.

What are tables, queries, and views in a database?

A table has rows and columns; each row is a record and each column is an attribute. A query asks a question with conditions and retrieves matching records. A view is a set of stored queries.

What is the difference between DDL and DML commands?

DDL commands define or modify the structure of a database or its objects. CREATE, ALTER, DROP, RENAME, and TRUNCATE are DDL commands. DML commands work with data: INSERT adds rows, UPDATE changes data, and DELETE removes records.

What do COMMIT and ROLLBACK do in SQL?

COMMIT permanently saves changes into the database. ROLLBACK restores the database to its original form since the last COMMIT. Both are transaction control commands used to manage database transactions.

How do I create and select a database in SQL?

Use CREATE database databasename; to create a database. Then use USE databasename; to select it. For example, CREATE database studentDB; creates studentDB, and USE studentDB; selects it for operations.

What is the difference between SELECT * and SELECT column1, column2?

SELECT * from tablename; retrieves all columns from a table. SELECT column1, column2 from tablename; retrieves only the named columns. Both commands retrieve records, but the second limits which fields appear in the results.

What does the WHERE clause do in SQL?

The WHERE clause gives the condition used to select or modify records. For example, WHERE firstname=”Mani” can identify records with that firstname. The number of records updated depends on the condition.

How do I sort SQL query results in descending order?

Use ORDER BY with the column name, followed by DESC. For example, select * from Biodata ORDER BY firstname DESC; displays the results in descending order by firstname.

What is the difference between GROUP BY and JOIN in SQL?

GROUP BY groups records that share a value, and it can be used with SUM(Marks) to total marks for each group. JOIN retrieves data from multiple tables by matching columns that hold identical values.

Practice

Question 1 of 6Score 0

What does a DBMS help users do?

Exam questions

Practice questions with model answers. These are not from an official paper.

What is a DBMS, and what does it allow users and programmers to do?2 marks

A DBMS is system software for creating and managing databases. It provides a systematic way to create, retrieve, update and manage data.

State two limitations of file systems that database systems helped overcome.2 marks

File systems could create duplicate copies of data, needed high maintenance for access control and consistency checks, and provided less security. Any two are acceptable.

Explain the difference between a primary key and a foreign key.5 marks

A primary key and a foreign key are keys used in relational tables. They differ in their purpose and in the rules that apply to their values.

  1. Primary key identifies a record: A primary key is the candidate key selected to identify records in a table.
  2. Primary key values are unique: Every tuple must have a unique value for its primary key.
  3. Foreign key represents a relationship: A foreign key is a copy of a primary key from one relation, exported into another relation to show a relationship between them.
  4. Foreign key values need not be unique: Unlike primary key values, foreign key values usually do not have to be unique.
  5. Foreign keys may be null: A foreign key can also have a null value.
  6. Composite keys: A primary key made from more than one attribute is composite. If the parent primary key is composite, the foreign key copied from it is also composite.

Thus, a primary key uniquely identifies a record, while a foreign key represents a relationship by referring to a primary key.

Describe the purposes of DDL, DML and DQL, giving one command for each.5 marks

SQL commands are classified by their purpose. DDL defines database structures, DML works with table records, and DQL retrieves data.

  1. DDL — purpose: Data Definition Language is used to define and manage database structures such as databases and tables.
  2. DDL — command: CREATE is one DDL command; it creates a table with fields as needed.
  3. DML — purpose: Data Manipulation Language is used to add, change, or remove records in a table.
  4. DML — command: INSERT adds a new record to a table.
  5. DQL — purpose: Data Query Language is used to fetch or retrieve data from database tables.
  6. DQL — command: SELECT retrieves records from a table, with conditions if required.

Example: In an online shopping site, tables such as Customer, Products, Order and Payment can be created.

Thus, DDL defines structures, DML manipulates records, and DQL retrieves data.

Watch out

  • Do not confuse a column, also called an attribute, with a row, also called a record or tuple.
  • Do not treat SQL as a database; it is a language used to access and manipulate databases.

Still stuck on this lesson?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →