📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 204question

STRUCTURED QUERY LANGUAGE (SQL) · Part 8

Chapter 2: 3 · COMPUTER SCIENCE

definition. Let us take a new table namely Student1 with the following fields Admno, Firstname, Lastname, Gender, Age, Place: 12th Computer Chapter - - CREATE TABLE Student ( Admno integer NOT NULL, Firstname char( ), Lastname char( ), Gender char( ), Age integer, Place char( ), PRIMARY KEY (Firstname, Lastname) → Table constraint ); In the above example, the two fields, Firstname and Lastname are defined as Primary key which is a Table constraint. . .

DML COMMANDS Once the schema or structure of the table is created, values can be added to the table. The DML commands consist of inserting, deleting and updating rows into the table. . .

. INSERT command The INSERT command helps to add new data to the database or add new records to the table. The command is used as follows: INSERT INTO <table-name> [column-list] VALUES (values); INSERT INTO Student (Admno, Name, Gender, Age, Place) VALUES ( , ‘Ashish’, ‘M’, , ‘Chennai’); INSERT INTO Student (Admno, Name, Gender, Age, Place) VALUES ( , ‘Adarsh’, ‘M’, , ‘Delhi’); Two new records are added to the table as shown below: Admno Name Gender Age Place e Ashish M Chennai Adarsh M Delhi The order of values must match the order of columns in the CREATE TABLE command. Specifying the column names is optional if data is to be added for all columns.

The command to add values into the student table can also be used in the following way: INSERT INTO Student VALUES ( , ‘Akshith’, ‘M’, , ‘Bangalore’); Akshith M Bangalore The above command inserts the record into the student table. To add data to only some columns in a record by specifying the column name and their data, it can be done by: 12th Computer Chapter - - Structured Query Language INSERT INTO Student(Admno, Name, Place) VALUES ( , ‘Ayush’, ‘Delhi’); Ayush M Delhi The above command adds the following record with default values of ‘M’ for Gender and Age as . INSERT INTO Student (Admno, Name, Place) VALUES ( , ‘Abinandh’, ‘Chennai’); Abinandh M Chennai

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →