Draw a diagram showing how a database is used in a social media app and a banking app. Include the user, the app interface, the database, and the flow of information between them.
Database in everyday apps (social media, banking) in Intro to Computing - Draw & Build Visually
Start learning this pattern below
Jump into concepts and practice - no test required
or
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Draw This - beginner
Grading Criteria
Solution
User | v +---------+ +------------+ +------------+ | Social |<----->| Social |<----->| Social | | Media | | Media App | | Database | | Interface| +------------+ +------------+ User | v +---------+ +------------+ +------------+ | Banking |<----->| Banking |<----->| Banking | | Interface| | App | | Database | +---------+ +------------+ +------------+
This diagram shows two examples: a social media app and a banking app.
1. The User interacts with the app through the Interface (like a screen or website).
2. The App sends and receives data from the Database, which stores all the information (like posts, messages, or account details).
3. Arrows show the flow of data: the user sends requests to the app, the app queries or updates the database, and the database sends back the needed information.
This simple flow helps apps work smoothly and keep user data safe and organized.
Variations - 2 Challenges
[intermediate] Draw a flowchart showing how a user logs in to a banking app and how the database verifies the user credentials.
[advanced] Draw a detailed diagram showing how a social media app stores user posts, comments, and likes in the database and how the app retrieves this data to display to the user.
Practice
1. What is the main purpose of a database in apps like social media or banking?
easy
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 BQuick 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
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 CQuick 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
What will be the result of a query that finds all users older than 23?
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
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 AQuick 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
But the app returns an error. What is the most likely mistake?
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
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 columnBalanceis misspelled or missing in the table.Final Answer:
The columnBalancedoes not exist or is misspelled -> Option AQuick 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:
If
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
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 DQuick Check:
Check both friend columns for user 5 [OK]
Hint: Friends can be in either column, check both [OK]
Common Mistakes:
- Checking only one side of friend pairs
- Selecting user 5 instead of their friends
- Using wrong columns in subqueries
