databases Flashcards

1
Q

what is a database

A

collection of data organised in a way that makes easy to store retrieve and manipulate data either electronic or paper based

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is the advantage of electronic database

A

more efficent easy to store, mangae and retreive files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

single table database

A

single table makes up database eg. spreadsheet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

table

A

collection of rows and columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is a row called in databases

A

records

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is a record, how should you count its quantity

A

record is collection of related fields about an entity
do not count first row, as its headers of columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what do you call columns in databases

A

fields or attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are fields or attributes

A

piece of info about an entity (columns)
each field is made up of same datatype

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

entity

A

anything about which data can be collected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is a data dictionary

A

table that shows collection of fields and their data types and metadata

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

metadata

A

data about data, info about existing data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are the different data types

A

real, character, integer text/ alphanumeric, boolean, date/time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

character

A

single letter, number, value, eg. s, 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

real

A

decimals eb. 12.6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

integer

A

whole number can be zero and negative

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

text/ alphanumeric

A

string of characters can contain combination of letters with numbers and symbols
Num, Num1, Num_1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

data/time

A

represent date or time, must specify seperator used in between eg. / or - or :
eg. 17/06/24
17-6-43
15:00:34

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

boolean

A

TRUE or FALSE

19
Q

why is data type important for inputting data of database

A

if wrong data type, data might not be accepted, this is done by validation rules

20
Q

primary key

A

field that uniquely identifies one record from all stores in a database table

21
Q

SQL

A

structured query language- database manipulation language used to manage data in a database, ued to perform operations on database

22
Q

what are some things SQL can perform

A

create database, create table, retreive data from databases, execute queries, display records

23
Q

what is SELECT…FROM used for, and how

A

used to specify fields you want to view from database table
3 variations:
SELECT <filedname> FROM <tablename>
SELECT <fieldname1>, <fieldname2> FROM <tablename>
SELECT * FROM <tablename></tablename></tablename></fieldname2></fieldname1></tablename></filedname>

23
Q

how do you select more than one field to output

A

list fields you want to slect by adding a coma in between eg

24
Q

how do you select entire table

A

adding asteriscs

25
Q

why is SELCT…..FROM….WHERE used? and how.

A

outputs data that meets specified criteria
eg.
SELECT <fieldname>
FROM <tablename>
WHERE <condition></condition></tablename></fieldname>

eg. SELECT <fieldname>
FROM <tablename>
WHERE <fieldname> = "dubai"</fieldname></tablename></fieldname>

26
Q

what are the different operations you can use for <CONDITION></CONDITION>

A

equal to =
not equal to <>
less than <
greater than >
less than or equal to <=
greater than or equal to >=

27
Q

how do you add more than one <condition></condition>

A

use boolean operations
either AND or OR

28
Q

explain AND operation

A

both criteria must be met

eg. SELECT <fieldname>
FROM <tablename>
WHERE <fieldname> = "dubai" AND <fieldname> > 16</fieldname></fieldname></tablename></fieldname>

29
Q

explain OR operation

A

used when either one or both criteria must be met

30
Q

how and why do you use ORDER BY

A

used togehter with select to sort field or data retrieved from table in ascending or descending order, by default ORDER BY automatically ascneding order

eg.
SELECT <fieldname>
FROM <tablename>
WHERE <fieldname> = "dubai" AND <fieldname> > 16
ORDER BY <fieldname>DESC</fieldname></fieldname></fieldname></tablename></fieldname>

31
Q

what are the two types of ORDER BY

A

ascending

<fieldname>ASC or descending
<fieldname>DESC
</fieldname></fieldname>

32
Q

what happens when you use ORDER BY in text (string) fields

A

orders by ascending or descending alphabetical order

33
Q

how and why do you use SUM

A

only used in columns with numeric values, find sum of all values that meet specified criteria

SELECT sum<fieldname>
FROM <tablename>
WHERE <fieldname> > 16</fieldname></tablename></fieldname>

34
Q

how and why is COUNT used

A

count number of records (rows) that meet certain criteria, can be text as well as numeral

eg.SELECT count <fieldname>
FROM <tablename>
WHERE <fieldname> = "dubai" AND <fieldname> > 16</fieldname></fieldname></tablename></fieldname>

35
Q

global varible

A

is accessible anywhere in the program EXCEPT inside the function where a variable of the same name is defined
– scope is the whole program
– value can be changed anywhere in the program

36
Q

local variable

A

only accessible inside the function, and can only be passed back to the global scope as a return value.

  • local variables - scope is a defined block of code/subroutine/procedure/function
    value cannot be changed elsewhere in the program
37
Q

what are features of a maintanble program

A

-meaningful identifiers
– the commenting feature provided by the
programming language
– procedures and functions
– relevant and appropriate commenting of
syntax

38
Q

purposes of files

A

-Files provide a way to ​store data ​permanently, allowing programs to access and manipulate it later
-Files allow for ​organised storage​ of data, making it easier to find, access, and update
-They enable ​sharing​ of data between different programs and users
-They support ​data backup, ensuring data is not lost when a program or computer system shuts down
-They allow for ​large amounts of data​ to be stored and managed efficiently
-Data can be transported from one system to another

39
Q

Explain why a programmer would use procedures and parameters when writing a program.

A

procedure:
-to enable the programmer to write a collection of programming statements under a single identifier
-to allow procedures to be re-used within the program or in other programs
- to enable different programmers to work on different procedures in the same project
-o make programs easier to maintain due to being shorter.

parameters
-to pass values from the main program to a procedure /
-so that they can be used in the procedure
-allow the procedure / function to be re-used with different data.

40
Q

how should you output sql language

A

in order that they appear in table, and in order that they are listed in SELECT

41
Q

what does verifying ensure

A

ensure datas has been accurately copied from one source to another

42
Q

Give two reasons for storing data in a file

A

data is stored permanently
* data can be moved to another computer
* another copy of data can be made and stored//accessed elsewhere // backup copy