Question
Download Solution PDFWhich 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
Answer (Detailed Solution Below)
Option 2 : CREATE TABLE Students (Rollno int, Name varchar ( 200 ), Age int )
Free Tests
View all Free tests >
Beltron Programmer Mock Test
0.8 K Users
20 Questions
20 Marks
24 Mins
Detailed Solution
Download Solution PDFThe 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 onlyCREATE 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 numbersvarchar(n)
: For text strings up to n charactersdate
: For date valuesfloat
,decimal
: For numeric values with decimals
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.