Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a database in the context of everyday apps like social media or banking?
A database is a digital storage system that keeps all the information an app needs, like user profiles, posts, or transactions, organized and easy to find.
Click to reveal answer
beginner
How does a social media app use a database?
It stores user details, friends lists, posts, comments, and likes so the app can quickly show your feed and let you interact with others.
Click to reveal answer
intermediate
Why is data security important in banking databases?
Because banking databases hold sensitive information like account numbers and balances, protecting this data prevents theft and fraud.
Click to reveal answer
beginner
What is a real-world analogy for a database in an app?
Think of a database like a well-organized filing cabinet where each drawer holds different types of information, making it easy to find what you need quickly.
Click to reveal answer
beginner
How do apps keep databases updated with new information?
Apps send new data to the database whenever you post, send money, or update your profile, so the database always has the latest info.
Click to reveal answer
What does a database do in a social media app?
ACreates new posts automatically
BStores user posts and profiles
CDeletes old posts without permission
DSends messages to friends
✗ Incorrect
A database stores user posts and profiles so the app can display them when needed.
Why must banking databases be secure?
ATo prevent unauthorized access to sensitive data
BTo make the app run faster
CTo allow anyone to see account balances
DTo store pictures and videos
✗ Incorrect
Security protects sensitive banking data from theft or fraud.
Which of these is a good analogy for a database?
AA messy desk with papers everywhere
BA broken computer
CA blank notebook
DA well-organized filing cabinet
✗ Incorrect
A database is like a well-organized filing cabinet that stores information neatly.
How do apps update their databases?
ABy printing data on paper
BBy deleting all old data daily
CBy sending new data when users interact
DBy ignoring user actions
✗ Incorrect
Apps update databases by sending new data whenever users post or make changes.
What kind of information would a banking app store in its database?
AUser account numbers and transaction history
BUser favorite movies
CWeather forecasts
DSocial media posts
✗ Incorrect
Banking apps store account numbers and transaction history to manage finances.
Explain how a database supports a social media app in managing user data and interactions.
Think about what happens when you post or comment on social media.
You got /4 concepts.
Describe why data security is crucial in banking databases and how it protects users.
Consider what could happen if someone steals your bank details.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a database in apps like social media or banking?
easy
A. To send emails to users automatically
B. To store and organize information so it can be easily found and used
C. To control the app's colors and fonts
D. To create graphics and animations for the app
Solution
Step 1: Understand what apps need
Apps like social media and banking need to keep lots of information safe and easy to find.
Step 2: Role of a database
A database stores and organizes this information in tables, like a digital filing cabinet.
Final Answer:
To store and organize information so it can be easily found and used -> Option B
Quick Check:
Database = store and organize info [OK]
Hint: Databases hold data, not design or emails [OK]
Common Mistakes:
Confusing database with app design features
Thinking database sends emails
Mixing database with app styling
2. Which of the following is the correct way to describe a table in a database?
easy
A. A program that runs the app on your phone
B. A folder on your computer where files are saved
C. A place where data is stored in rows and columns, like a spreadsheet
D. A list of colors used in the app design
Solution
Step 1: Recall what a table is
A table in a database organizes data in rows and columns, similar to a spreadsheet.
Step 2: Compare options
Only 'A place where data is stored in rows and columns, like a spreadsheet' correctly describes this; others describe unrelated things.
Final Answer:
A place where data is stored in rows and columns, like a spreadsheet -> Option C
Quick Check:
Table = rows and columns [OK]
Hint: Think spreadsheet when you hear 'table' in databases [OK]
Common Mistakes:
Confusing tables with app programs
Mixing tables with computer folders
Thinking tables are design elements
3. Consider a social media app database table named Users with columns UserID, Name, and Age. If the table has these rows:
UserID | Name | Age
1 | Alice | 25
2 | Bob | 30
3 | Carol | 22
What will be the result of a query that finds all users older than 23?
medium
A. Alice and Bob
B. Bob and Carol
C. Alice, Bob, and Carol
D. Only Carol
Solution
Step 1: Identify users older than 23
Check each user's age: Alice (25) > 23, Bob (30) > 23, Carol (22) ≤ 23.
Step 2: List matching users
Alice and Bob meet the condition; Carol does not.
Final Answer:
Alice and Bob -> Option A
Quick Check:
Age > 23 = Alice, Bob [OK]
Hint: Filter by age > 23 carefully [OK]
Common Mistakes:
Including Carol who is 22
Missing Bob who is 30
Selecting all users without filtering
4. A banking app database has a table Accounts with columns AccountID, Balance. The following SQL query is written:
SELECT AccountID, Balance FROM Accounts WHERE Balance > 1000
But the app returns an error. What is the most likely mistake?
medium
A. The column Balance does not exist or is misspelled
B. The SQL query is missing a semicolon at the end
C. The table name Accounts is misspelled
D. The query should use SELECT * FROM Accounts instead
Solution
Step 1: Check query syntax
The query syntax is correct and semicolon is optional in many systems.
Step 2: Verify column names
If the app errors, likely the column Balance is misspelled or missing in the table.
Final Answer:
The column Balance does not exist or is misspelled -> Option A
Quick Check:
Column name error causes query failure [OK]
Hint: Check column names carefully for typos [OK]
Common Mistakes:
Assuming missing semicolon causes error
Thinking table name is wrong without checking
Believing SELECT * fixes column errors
5. A social media app wants to show a list of friends for a user. The database has two tables:
Users(UserID, Name)
Friends(UserID1, UserID2)
If UserID1 and UserID2 represent friend pairs, which SQL query correctly finds all friends of user with UserID = 5?
hard
A. SELECT Name FROM Users WHERE UserID IN (SELECT UserID2 FROM Friends WHERE UserID1 = 5)
B. SELECT Name FROM Users WHERE UserID = 5
C. SELECT Name FROM Users WHERE UserID IN (SELECT UserID1 FROM Friends WHERE UserID2 = 5)
D. SELECT Name FROM Users WHERE UserID IN (SELECT UserID1 FROM Friends WHERE UserID2 = 5) OR UserID IN (SELECT UserID2 FROM Friends WHERE UserID1 = 5)
Solution
Step 1: Understand friend pairs
Friends table stores pairs (UserID1, UserID2) meaning both are friends.
Step 2: Find all friends of UserID 5
Friends can appear as UserID1 or UserID2, so query must check both sides.
Step 3: Analyze options
SELECT Name FROM Users WHERE UserID IN (SELECT UserID1 FROM Friends WHERE UserID2 = 5) OR UserID IN (SELECT UserID2 FROM Friends WHERE UserID1 = 5) checks both UserID1 and UserID2 for 5, correctly finding all friends.
Final Answer:
SELECT Name FROM Users WHERE UserID IN (SELECT UserID1 FROM Friends WHERE UserID2 = 5) OR UserID IN (SELECT UserID2 FROM Friends WHERE UserID1 = 5) -> Option D
Quick Check:
Check both friend columns for user 5 [OK]
Hint: Friends can be in either column, check both [OK]