9 - Databases Flashcards
What is data? [2]
- refers to the individual pieces of information that are stored
- information about something
What is a base? [2]
- signifies that it is the foundation or platform
- where data is stored and managed
What are examples of data and what can it include? [2]
- someone’s age, someone’s salary, etc
- can include: text, pictures, numbers, multimedia, etc
What is a database? [3]
- structured collection of data that allows people to extract, add, delete and update information in a way that meets their needs
Where are databases used? [3]
- to store information about people
- to store information about things
- to store information about events
What are examples of information that might be stored about people? [2]
- patients in a hospital
- pupils at a school
What are examples of information that might be stored about things? [2]
- cars to be sold
- books in a library
What are examples of information that might be stored about events? [2]
- hotel bookings
- results of races
What are flat files? [2]
- a simple table consisting of fields in columns and records in rows
Why are flat files called flat? [2]
- they store data in a simple, plain text format without any complex structure
- the data is organised in a straightforward manner
How is data organised in a flat file? [2]
- seperated by commas or tabs
- each line represents a single record
What are examples of flat files? [3]
- notepad
- microsoft excel
- microsoft word
What are the issues related to flat files? [3]
- data inconsistency (not updated)
- miscommunication
- takes up too much storage
What are the solutions to these issues? [6]
(3 reasons + explanations)
- data is stored centrally and accessed by different applications
- changes made by one application is reflected in another application
- access rights and privileges are maintained so you can control who can access, edit and modify data
What are the two things a table consists of? [2]
- fields
- records
What is a field + example? [2]
- one type of information
- e.g. name
What is a record + example? [2]
- details
- e.g. name, age, salary together
What does a table contain data about? [3]
one type of item, person or event + given a meaningful name
What does a record within a table contain data about? [3]
a single item, person or event
What are the data types used in databases? [6]
- text/alphanumeric
- character
- boolean
- integer
- real
- data/time
Give examples of each data type used in databases. [6]
- text: Sumridhi
- character: S
- boolean: Yes/No
- integer: 16
- real: 11.23
- date/time: 23/06/09
What does a data type classify? [2]
- how the data is stored and displayed
- the operations that can be performed on the stored value
What is a real data type? [1]
a decimal number
What is a primary key? [1]
a field in a database that uniquely identifies a record
Why do we use a primary key on a table? [2]
- to uniquely identify the data
- make sure there’s no repeats
What is an example of the main primary key used? [1]
user ID
What does a field that is a primary key contain? [1]
data values that are never repeated in the table
What issues are faced on a table without a primary key? [2]
- update / modification issues
- insertion issues as rows wouldn’t be uniquely identified
What are the advantages of using database system over flat file system? [3]
- imrpoved data security and consistency
- enhanced data access and sharing
- makes data management more efficient and structured
What does SQL stand for? [1]
Structured Query Language
Why is SQL used? [2]
- used to obtain information from single-table databases
- for writing scripts to obtain useful information from a database
What are the possible miconceptions about SQL? [3]
- it’s case insensitive
- end every command with a semi colon
- must be used to separate items
What are the shortcuts used for SQL scripts? For example how are the data types identified. [3]
- text: varchar
- length of data type: (__)
- number: int
What is the script for creating a database? [1]
create database ___ ;
What is the script for creating a table? [2]
create table __(table name)__
(fieldname#1 datatype,
fieldname#2 datatype,
fieldname#3 datatype) ;
What is the script for inserting data into a table? [2]
insert into _(table name)__
(fieldname#1, fieldname#2, fieldname#3)
values (value#1, value#2, value#3) ;
What is the script for selecting all the data from a table? [1]
select * from __(table name)__;
What is the script for selecting a particular field of data from a table? [2]
select __(field name)__ from __(table name)__ ;
What is the script for selecting multiple fields of data from a table? [2]
select __(field#1)__, __(field#2)__ from __(table name)__ ;
What is the script for selecting all the data based on a condition? [2]
select * from __(table name)__
where __(condition)__ ;
What is the script for selecting all the data based on multiple conditions? [2]
select * from __(table name)__
where __(condition#1)__ and __(condition#2)__ ;