0% found this document useful (0 votes)
11 views3 pages

SQL_introdoc

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

SQL_introdoc

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DBMS Task – SQL Introduction

Name: P.SaiKarthik Reddy


Roll Number: 160121733190
Class: CSE – 3

1. Create a table using SQL which should have a table name, list of columns and
respective names, data type of each column and a set of constraints, also retrieve the
data from the table created.
Sol:
Problem Statement:
To create a table using SQL with specified information such as table name, column names,
data types, and constraints, and retrieve the data from the created table.
Description:
→ Open the mysql site and create a new worksheet
→ Create a table with a name and define the entities to be used in the table
→ Define the data type that is to be used, for each entity in the table.
→ Start inserting data into table in the order of the entities defined while creating the
table. Add around 10 sets of data into table.
→ Retrieve the entire data from the table.
→ Retrieve partial amounts of data, by setting some constraints on the statements.
Concepts used:
Syntaxes used for
→ Creating table:
create table table_Name( column1Name datatype, col2Name
datatype……colnName datatype);

→ Inserting data into tables:


insert into tableName(col_1name,col_2name…col_nName)
values(val_for_col1,val_for_col2…val_for_coln);

→ Retrieval of entire table:


select * from tableName;

→ Retrieval of a column from table:


select col1Name,col2Name,….colnName from
tableName;
→ Retrieval of a row/column of data based on certain constraint:
select col1Name,col2Name,….colnName from
tableName where condition;

Code:
create table student(rollNum number,fName varchar(10),lName varchar(10),branch
varchar(4));
insert into student(rollNum,fName,lName,branch) values (101,'sam','mmm','CSE');
insert into student(rollNum,fName,lName,branch) values (102,'shyam','kumar','CSE');
insert into student(rollNum,fName,lName,branch) values (103,'rinku','singh','CSE');
insert into student(rollNum,fName,lName,branch) values (104,'tulasi','ram','CSE');
insert into student(rollNum,fName,lName,branch) values (105,'vadala','laxmi','ECE');
insert into student(rollNum,fName,lName,branch) values (106,'vislavath','ganesh','ECE');
insert into student(rollNum,fName,lName,branch) values (107,'jay','sundar','ECE');
insert into student(rollNum,fName,lName,branch) values (108,'Mudigonda','deva','MECH');
insert into student(rollNum,fName,lName,branch) values (109,'keshav','komma','MECH');
insert into student(rollNum,fName,lName,branch) values (110,'gupta','omkar','MECH');
select * from student;
select rollNum from student;
select fname from student where rollNum=107;
select * from student where branch='ECE';

Output:

You might also like