Consider the following tables PARTICIPANT and ACTIVITY and answer the questions that follow :
Table : PARTICIPANT
| ADMNO | NAME | HOUSE | ACTIVITYCODE |
|---|---|---|---|
| 6473 | Kapil Shah | Gandhi | A105 |
| 7134 | Joy Mathew | Bose | A101 |
| 8786 | Saba Arora | Gandhi | A102 |
| 6477 | Kapil Shah | Bose | A101 |
| 7658 | Faizal Ahmed | Bhagat | A104 |
Table : ACTIVITY
| ACTIVITYCODE | ACTIVITYNAME | POINTS |
|---|---|---|
| A101 | Running | 200 |
| A102 | Hopping bag | 300 |
| A103 | Skipping | 200 |
| A104 | Bean bag | 250 |
| A105 | Obstacle | 350 |
When the table “PARTICIPANT” was first created, the column ‘NAME’ was planned as the Primary key by the Programmer. Later a field ADMNO had to be set up as Primary key. Explain the reason. OR Identify data type and size to be used for column ACTIVITYCODE in table ACTIVITY.
🔒You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
🔒 Start your 14-day free trial to unlock the full solution →Part (a)Concept understanding — Primary Key Identification
Primary Key Identification
Think about how you tell two students apart in a classroom. If you call out "Rahul," there might be three Rahul's. But if you say "Rahul Sharma, roll number 12," you've pointed to exactly one person. That unique identifier — the roll number — is doing the job of a primary key.
The Everyday Intuition
Every collection of things needs a way to refer to each item without confusion. In a library, every book has a unique accession number. In a bank, every account has an account number. In a school, every student has a unique admission number. These are not random — they are deliberately chosen so that no two items share the same identifier.
This is the core idea: a primary key is a single attribute (or a combination of attributes) that uniquely identifies each record in a table. No two rows can have the same primary key value, and no primary key can be empty (null).
The Precise Meaning
In database terms, a primary key serves two non-negotiable rules:
- Uniqueness — every value in the primary key column must be different from every other value. If you have 100 students, you need 100 distinct roll numbers.
- Non-null — every record must have a primary key value. You cannot have a student with "no roll number."
A primary key can be a single column, like a student ID. Or it can be a composite key — two or more columns taken together to create uniqueness. For example, in a table recording which books students have borrowed, neither "Student ID" alone nor "Book ID" alone is unique (a student borrows many books; a book is borrowed by many students over time). But the combination of "Student ID + Book ID + Date Borrowed" together can be unique.
A primary key is not just any unique column. It is the official, chosen identifier for that table. A table can have many columns that are unique (like Aadhaar number, PAN number, and email), but only one of them is designated as the primary key. The others are called candidate keys — they could have been the primary key, but weren't chosen.
Why It Matters
Without a primary key, you cannot reliably update or delete a specific record. Imagine a school database where two students have the same name "Ananya Sharma." If you try to delete "Ananya Sharma," the database has no way to know which one you mean. With a primary key, you say "delete student with roll number 45" — and it's unambiguous. …
Part (b)Concept understanding — MySQL Data Types
MySQL Data Types: Storing Information the Right Way
Think of a library. Every book has a specific place, and the librarian knows exactly what kind of item each shelf holds — novels go here, reference books there, magazines in a separate rack. If you shoved a dictionary into the magazine rack, it wouldn't fit, and finding it later would be a mess.
MySQL works the same way. When you create a table to store data, you must tell MySQL what kind of data each column will hold. This is called a data type. It's the rule that says: "This column will only ever contain whole numbers" or "This column will only ever hold short text." Getting this right from the start is what keeps your database organised, fast, and reliable.
Why Data Types Matter
Without data types, MySQL would have no idea how much space to reserve for each piece of information, or how to sort and compare values. If you stored a phone number as a number, MySQL might try to add it to another number — which makes no sense. If you stored a date as plain text, MySQL couldn't tell you "which records are from last month."
Every column in every table must have a data type. It's not optional. And choosing the right one is a skill you build with practice.
The Main Families of Data Types
MySQL offers many data types, but they fall into a few broad families. For a commerce or humanities student, these are the ones you'll use most often.
1. String (Text) Types
These store words, sentences, names, addresses, product descriptions — anything made of letters, digits, or symbols.
CHAR— Fixed-length text. If you sayCHAR(10), every entry takes exactly 10 characters, even if you only store "Hi". MySQL pads the rest with spaces. Use this when you know the length will always be the same, like a state code ("MH", "DL", "KA").VARCHAR— Variable-length text. If you sayVARCHAR(100), an entry like "Mumbai" uses only 6 characters of space, not 100. This is the workhorse for names, addresses, email IDs, and most short-to-medium text.TEXT— For long paragraphs, like product reviews or article bodies. It can hold up to about 65,000 characters. There are larger variants (MEDIUMTEXT,LONGTEXT) for very long content.
Always choose the smallest type that fits your data. A VARCHAR(255) for a person's name is fine; a TEXT for a 10-character pincode wastes space and slows down your queries.
2. Numeric Types
These store numbers — but not all numbers are the same.
INT— Whole numbers (integers) from roughly -2 billion to +2 billion. Use this for quantities, IDs, years, counts. Most of the time,INTis what you need.DECIMAL— Numbers with decimal places, where exact precision matters. Think prices, tax rates, percentages.DECIMAL(10,2)means 10 digits total, with 2 after the decimal point — perfect for ₹1,234.56.FLOATandDOUBLE— Approximate decimal numbers. Faster for scientific calculations, but can have tiny rounding errors. Avoid these for money.
Never store currency amounts in FLOAT or DOUBLE. Use DECIMAL instead. A rounding error of 0.01 paise multiplied across thousands of transactions is a real problem.
3. Date and Time Types
These store dates, times, or both — and MySQL understands them natively, so you can ask questions like "find all orders from last week."
DATE— Stores a date only: '2025-04-10'. No time.DATETIME— Stores date and time together: '2025-04-10 14:30:00'. This is the most common choice for timestamps of transactions, registrations, or log entries.TIMESTAMP— Similar toDATETIME, but with a smaller range and automatic timezone conversion. Often used for "last updated" fields.YEAR— Just a four-digit year. Useful for birth years or academic sessions.
4. The Boolean Type
MySQL doesn't have a true/false data type in the way you might expect. Instead, it uses BOOLEAN or BOOL, which is really just a tiny integer — 0 means false, 1 means true. You'll use this for yes/no fields like "is_active", "has_discount", or "verified".
How to Choose: A Simple Rule
Ask yourself three questions about every piece of data you want to store:
- Is it text, a number, or a date? That tells you the family.
- How long or how big can it be? That tells you the specific type within the family. …
Part (a)
A primary key must be unique and non-null. In the PARTICIPANT table the NAME "Kapil Shah" appears twice (ADMNO 6473 and 6477), so NAME has duplicate values and cannot uniquely identify a record — it fails the uniqueness rule. ADMNO was set up as the primary key instead because every admission number (6473, 7134, 8786, 6477, 7658) is distinct, so it identifies each participant unambiguously. …
Part (a): NAME is not unique ("Kapil Shah" repeats), so ADMNO — which is unique — was made the primary key.
Part (b): ACTIVITYCODE is a fixed 4-character code, so CHAR(4) (size 4) is the right data type.
Part (a) — why ADMNO replaced NAME as the primary key
A primary key has two mandatory properties: uniqueness (no two rows share the value) and non-nullability (every row has a value). The programmer first picked NAME, but the data breaks the uniqueness rule:
ADMNO NAME
6473 Kapil Shah
6477 Kapil Shah <- same NAME as ADMNO 6473
``` …
- CBSE 2026Set 91/41 markMCQQ.Assertion (A) : The PRIMARY KEY constraint in SQL ensures that each value in the column(s) is unique and cannot be NULL. Reason (R) : Candidate keys are not eligible to become a primary key. (A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A). (B) Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A). (C) Assertion (A) is true, but Reason (R) is false. (D) Assertion (A) is false, but Reason (R) is true.
›Reveal solutionSolution
Assertion (A) is correct—a PRIMARY KEY enforces uniqueness and disallows NULL values—but Reason (R) is false because candidate keys are precisely the keys eligible to become a primary key.
The assertion captures the essence of what a PRIMARY KEY constraint does in a relational database. When you designate a column (or a combination of columns) as the primary key of a table, the database management system enforces two iron rules: every value in that column must be unique across all rows, and no row may have a NULL value in that column. This dual guarantee—uniqueness plus mandatory presence—is what makes a primary key the definitive identifier for each record. Without it, you cannot reliably distinguish one row from another, and the entire relational model begins to crumble.
Now consider the reasoning offered. It claims that candidate keys are not eligible to become a primary key. This is precisely backwards. In database design, a candidate key is any column or set of columns that satisfies the two criteria above: it uniquely identifies each row, and it contains no NULL values. A table may have several candidate keys—employee ID, email address, and passport number might all uniquely identify a person—but you choose exactly one of these candidate keys to serve as the primary key. The others remain as alternate keys (sometimes called unique keys), still enforcing uniqueness but not bearing the special status of "primary." So candidate keys are not merely eligible to become the primary key; they are the only keys eligible for that role.
ImportantA candidate key is defined as a minimal superkey—any attribute or combination of attributes that can uniquely identify a tuple and contains no NULL values. The primary key is simply the candidate key you select to be the principal identifier. …
- CBSE 2025Set 91/41 markMCQQ.In MYSQL, which type of value should not be enclosed within quotation marks ? (A) DATE (B) VARCHAR (C) FLOAT (D) CHAR
›Reveal solutionSolution
Numeric types like
FLOATare written as bare numbers in SQL; only string and date types require quotation marks. The answer is (C) FLOAT.When you write a SQL query, MySQL needs to distinguish between different kinds of data. The rule is straightforward: text-like data (strings, dates written as text) goes inside quotes, while numeric data is written as a bare number.
Think about it this way: when you say
age = 25, MySQL sees25as a number it can do arithmetic with. But when you sayname = 'John', the quotes tell MySQL "this is literal text, not a column name or keyword." Dates in MySQL are stored internally as numbers, but you write them as strings like'2024-01-15', so they need quotes too.Let's examine each option:
-
DATE – Even though dates represent moments in time, you supply them to MySQL as text strings in a specific format (YYYY-MM-DD). So
birth_date = '1990-05-20'requires quotes. Without them, MySQL would try to interpret1990-05-20as arithmetic: 1990 - 5 - 20 = 1965. -
VARCHAR – This is a variable-length string type. Any string value must be quoted:
city = 'Mumbai'. The quotes delimit where the string begins and ends. …
-
🎓Unlock everything free for 14 days
- ✓Full step-by-step solutions
- ✓Concept-first explanations
- ✓Methods, shortcuts & mistakes
- ✓PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.