0% found this document useful (0 votes)
1 views

Databases

A database is an organized collection of data that enables efficient access, management, and updating of information, with single-table databases being a simple design. Databases ensure data integrity, allow multi-user access, and enable efficient data retrieval through structured fields and records. Key concepts include data types, primary keys for unique identification, and SQL for managing and manipulating data.

Uploaded by

thinuperera903
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Databases

A database is an organized collection of data that enables efficient access, management, and updating of information, with single-table databases being a simple design. Databases ensure data integrity, allow multi-user access, and enable efficient data retrieval through structured fields and records. Key concepts include data types, primary keys for unique identification, and SQL for managing and manipulating data.

Uploaded by

thinuperera903
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

9.

Databases
A database is an organized collection of data that allows easy access, management, and updating of information. It
stores data in a structured way so that it can be efficiently retrieved, modified, and maintained.

Single-table database
A single-table database is a simple database design where all the data is stored in a single table, rather than being
split across multiple tables.

Why are databases useful?


1. Data Integrity and Consistency - Databases use rules (like constraints) to ensure that the data remains
accurate and consistent (e.g., no duplicate entries or invalid data).
2. Multi-User Access - Multiple users can access and modify data simultaneously without conflicts through
concurrency control mechanisms.
3. Efficient Data Retrieval - Query languages like SQL allow users to quickly search, sort, and filter data.

Fields and records of a database table


In a database table, fields and records are essential components that help structure and store data systematically.

1. Fields (Columns) - A field is a single data attribute or column in a table, representing a specific type of
information for all records
2. Records (Rows) - A record is a complete row in a table, representing a single entry with values for all fields.

Validation
Validation in databases refers to the process of ensuring that the data entered into the database is accurate,
consistent, and follows specific rules. This prevents errors, maintains data integrity, and ensures the reliability of
the database.

Refer Figure 9.3, Figure 9.4 in the text book.

1
Basic data types
There are six basic data types that you need to be able to use in a database,

1. text/alphanumeric
2. character
3. Boolean
4. Integer
5. Real
6. date/time

What is a data type?


A data type in databases defines the type of data that a particular field (column) can hold. It ensures consistency
and helps the database management system (DBMS) allocate the correct amount of storage space and perform
operations appropriately.

Primary key
A primary key is a field (or a combination of fields) in a database table that uniquely identifies each record. It
ensures that no two rows have the same value for the primary key, and it cannot contain NULL values. The primary
key is essential for maintaining data integrity and establishing relationships between tables in a relational
database.

SQL
SQL (Structured Query Language) is a standardized programming language used to manage, retrieve, and
manipulate data in relational databases.

SQL scripts
An SQL script is a collection of SQL commands stored in a file that can be executed together. It is often used to
automate database tasks such as creating tables, inserting data, updating records, or managing permissions.

2
Basic format of SQL script:

SELECT Field1, Field2, etc.

FROM TableName

WHERE Condition

ORDER BY Field1, Field2 DESC

You might also like