Databases and SQl Flashcards
What are the data types to choose from when creating database fields?
⚫️integer
⚫️float
⚫️date / time /Datetime
⚫️Char (FIXED length up to 8,000 characters)
⚫️Varchar (variable length string up to 8,000 characters )
⚫️Text (variable length string up to 2GB)
⚫️autonumber
What are flat file databases?
Stores sa single table of data inside a single text file
What are primary keys ?
A field that stores unique data for each record in a table.
What are some flat file database issues ?
🔵inconsistencies in the data , making it hard to search or sort the data
🔵redundant data, so the databases use more storage/memory than needed
What is a ‘flat file database “?
A database that has all the data stored in one table.
▪️Each record is identified as a new line
▪️flat file databases are often stored using a CSV (comma separated values )format
▪️each field is separated by a comma
What are relational databases ?
Contain multiple tables , each table is known as a relation. Each table has links to others known as relations.
What is a foreign key?
A field in a table that references the primary key of another table.
What is SQL?
Structured query language
The language allows you to create , query, update and delete data to and from databases
Write an SQL query to output all the first names of members and their memberID, who are male
- all normal PSEUDOCODE arithmetic and operational comparatives can be used
How do you select all the fields within a table to output
SELECT *
Wildcard
Write an SQL query to find all the fields of dogs that are older than four (including those that are 4) and whose colour contains the letter ‘B’
Sort this array called members into ascending order of town , up outputting the first name and memberID
Change the age of Molly from 5 to 6
Delete all the black spaniels from the table
Select the owner and dog names for all the four year old dogs
(Multiple tables )