Which of the following is the CORRECT way to create a student table with fields Roll no, Name, Age?

This question was previously asked in
Beltron Programmer 1 Oct 2023 Official Paper
View all BELTRON Programmer Papers >
  1. CREATE NEW TABLE Students (Rollno, Name, Age) (int, int, varchar ( 200 ))
  2. CREATE TABLE Students (Rollno int, Name varchar ( 200 ), Age int )
  3. CREATE TABLE Students ( Rollno, Name, Age ) ( int, int, varchar ( 200 ) )
  4. NEW TABLE Students ( Rollno int, Name varchar ( 200 ), Age int )

Answer (Detailed Solution Below)

Option 2 : CREATE TABLE Students (Rollno int, Name varchar ( 200 ), Age int )
Free
Beltron Programmer Mock Test
0.8 K Users
20 Questions 20 Marks 24 Mins

Detailed Solution

Download Solution PDF

The correct answer is Option 2) CREATE TABLE Students (Rollno int, Name varchar (200), Age int).

Key Points

  • This is the correct syntax for creating a table in SQL.
  • CREATE TABLE is the standard SQL command used to create a new table in a database.
  • The correct format is:
    CREATE TABLE TableName (Column1 DataType, Column2 DataType, ...);
  • In this case:
    • Rollno is an integer (int),
    • Name is a variable-length string (varchar) with a max size of 200 characters,
    • Age is also an integer (int).
  • This command will successfully create the "Students" table with the specified columns and data types.

Additional Information

  • Option 1 – Incorrect: CREATE NEW TABLE is not valid SQL syntax. The correct keyword is only CREATE TABLE.
  • Option 3 – Incorrect: Defining data types outside the column list is incorrect syntax in SQL.
  • Option 4 – Incorrect: NEW TABLE is not valid. SQL does not recognize this format for table creation.
  • Tip: Always define both column names and their corresponding data types inside the parentheses.
  • Common Data Types:
    • int: For whole numbers
    • varchar(n): For text strings up to n characters
    • date: For date values
    • float, decimal: For numeric values with decimals
Latest BELTRON Programmer Updates

Last updated on Nov 25, 2024

-> BELTRON Programmer 2024 Notification has been released on the official website.

-> The Bihar State Electronics Development Corporation Limited (BELTRON) has announced a recruitment drive for Programmer positions on a contractual basis.

-> Specific vacancy details will be shared separately.

-> Interested candidates can apply online from November 11, 2024, to December 10, 2024.

-> The Minimum age of the candidates should be 21 years and maximum age should be 59 year of age. 

More Relational Algebra Questions

Get Free Access Now
Hot Links: teen patti bliss teen patti cash game teen patti circle teen patti dhani master teen patti