English

code snippet. CREATE TABLE student( name CHAR(30) student_id INT, gender CHAR(1), PRIMARY KEY (student_id) ); What will be the output of following query? INSERT INTO student

Advertisements
Advertisements

Question

Choose the appropriate answer with respect to the following code snippet.

code snippet.
CREATE TABLE student(
name CHAR(30)
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);

What will be the output of following query?
INSERT INTO student

VALUES (“Suhana”,109,’F’),
VALUES (“Rivaan”,102,’M’),
VALUES (“Atharv”,103,’M’),
VALUES (“Rishika”,105,’F’),
VALUES (“Garvit”,104,’M’),
VALUES (“Shaurya”,109,’M’);

Options

  • Error

  • No Error

  • Depends on compiler

  • Successful completion of the query

MCQ
Advertisements

Solution

Error

Explanation:

INSERT INTO should use one VALUES keyword followed by multiple rows. Also, it student_id = 109 is repeated, but it is a PRIMARY KEY, so duplicate values are not allowed.

shaalaa.com
  Is there an error in this question or solution?
Chapter 8: Introduction to Structured Query Language (SQL) - Exercise [Page 170]

APPEARS IN

NCERT Informatics Practices [English] Class 11
Chapter 8 Introduction to Structured Query Language (SQL)
Exercise | Q 2. d) | Page 170
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×