SmartKalike — Education | AI

sTruCTured Query language (sQl) – important questions for Boards 2027

CBSE Class 12 Computer Science

Download free PDF
  1. VSA · 1 mark

    In VARCHAR(30), how many characters can be stored at most?

    Answer

    VARCHAR(30) can store a maximum of 30 characters. Its variable-length allocation depends on the actual string length; “city” occupies space for four characters.

  2. SA · 2 marks

    Name any two relational database management systems mentioned in the chapter.

    Answer

    MySQL and ORACLE are two relational database management systems mentioned in the chapter. They allow databases consisting of relations and support storing, retrieving and manipulating data through queries using SQL in their tables.

  3. MA · 3 marks

    Explain the purpose of the WHERE clause and whether it is mandatory. Write a SELECT query to retrieve all columns from STUDENT only for rows where RollNumber is 1.

    Answer

    1. WHERE retrieves data that meet specified conditions. The clause is optional, so a SELECT query can retrieve data without a condition. 2. SELECT * retrieves all columns, while FROM identifies the table containing them. 3. Query: SELECT * FROM STUDENT WHERE RollNumber = 1; The condition filters the result to rows whose RollNumber equals 1, and the query retrieves all columns for those rows.

  4. LA · 4 marks

    A CHAR(10) attribute stores the string 'city'. State the permitted range for n in CHAR(n), calculate how many character positions remain unused, and explain how MySQL stores those unused positions.

    Answer

    In CHAR(n), n can be any value from 0 to 255. CHAR is fixed-length, so MySQL fills unused positions with spaces padded on the right. 10 − 4 = 6 ∴ 6 character positions remain unused.

  5. LA · 5 marks

    Explain the purpose of SQL in working with relational databases. Include how it is used to access and manipulate database data.

    Answer

    SQL is the most popular query language used by major relational database management systems. 1. SQL provides a way to access and manipulate database data without writing application programs for file-based access. Its statements use descriptive English words and are not case sensitive. 2. SQL retrieves data by letting users specify what they want, without requiring them to specify how the data must be obtained. The SELECT statement retrieves data from database tables. 3. SQL defines the structure of data through Data Definition Language (DDL) statements. These statements can create, modify and delete relation schemas, including attributes, data types and constraints. 4. SQL also supports Data Manipulation Language (DML) operations. INSERT adds records, while UPDATE modifies existing data and DELETE removes data. SQL supports creating and interacting with databases, as well as defining, manipulating and retrieving their data.

  6. VLA · 10 marks

    A table is to contain RollNumber, SName, SDateofBirth, and GUID. Write a CREATE TABLE statement using suitable data types and constraints for these attributes: RollNumber is the primary key; SName is a variable-length name of at most 20 characters and is not null; SDateofBirth is not null; GUID is a fixed 12-character identifier and a foreign key. Explain how the number of columns determines degree and what attribute names, data types, and constraints specify.

    Answer locked. Unlock all answers on SmartKalike

  7. VSA · 1 mark

    What do SQL constraints do to attribute values, and are constraints mandatory for every attribute?

    Answer locked. Unlock all answers on SmartKalike

  8. SA · 2 marks

    What two things does the data type of an attribute determine?

    Answer locked. Unlock all answers on SmartKalike

  9. MA · 3 marks

    Name the SQL string functions that convert a string to uppercase and the functions that convert it to lowercase. Give one example expression for each case.

    Answer locked. Unlock all answers on SmartKalike

  10. LA · 4 marks

    For FLOAT and DATE, state the kind of data each stores and the storage occupied by FLOAT. Give the DATE format and supported range. Name the three broad categories of commonly used MySQL data types.

    Answer locked. Unlock all answers on SmartKalike

181 more probable questions in this chapter, every one with a full answer.

Unlock all answers on SmartKalike

Other chapters in Computer Science