Main components of JFrame in Netbeans:
1. Main
window
2. Frame
window
3. Project
Explorer
4. Pallette
5. Output
window
New project à
New JFrame (on right click)
Ques.
Create form with the following fields:
Employee Name
Emp id
Salary
HRA (20%)
DA (30%)
CCA (10%)
Gross
Tax
Net
Buttons = Submit and
Reset
Ques.
Create form with following fields:
College name
College id
Stream
Category
Fee
Buttons = Submit and
Reset
Making frames in cmd
Constructors used:
1. frame();
2. frame(String
str);
Menu
Frame
Database
RDBMS (Relational Database Management System) is
a collection of related databases.
Database is
a collection of tables.
Table is collection
of records.
Records are
collection of fields.
Fields are values of
attributes.
Attributes
are characteristics of an entity. e.g. Name is an attribute of a person.
Benefits
of Database
It helps in:
1. Data
Storage
2. Data
Management
3. Decision
making
Operations on
database:
1. Add
data
2. Delete
3. Modify
4. Select
Commands in Database
DDL (Data
Definition Language) commands are used to create table, modify table and drop
table. With the help of these commands, e can change the structure of a table.
Commands used:
·
Create
·
Alter
·
Drop
Format for
create: create table
table_name(fieldname datatype, fieldname datatype);
e.g. create
table Student(name varchar, rollno int)
Format for alter: alter table table_name add
coloumn column_name datatype
e.g. alter
table table_name add subject varchar(30)
Database demo
create database demo
create table student (sname varchar(30),
rollno int)
sp_help student
alter table student add subject
varchar(30)
alter table student drop column subject
DML
(Data Manipulation Language) commands.
Commands used:
·
Insert
·
Update
·
Delete
Format
for insert: insert
into table_name(fieldname, fieldname) values(value, value)
Format
for update: update
table_name set fieldname=value, fieldname=value where fielname=value
Format
for delete: delete
from table_name where fieldname=value
Database demo
create database demo
create table student (sname varchar(30),
rollno int)
sp_help student
alter table student add subject
varchar(30)
alter table student drop column subject
insert into student values(‘pec’,102,‘math’)
select * from student
update student set sname=‘pgi’,subject=’science’
where rollno=101
delete from student where rollno=101
Ques.
Create a table “Employee” with employee
name, id, salary, bonus, address.
Ans.
create
table employee(name varchar(30),id int primary key,salary int,bonus float,address varchar(30))
insert
into employee values('A', 1, 15000,1000, 'India')
insert
into employee values('B', 2, 15000,1000, 'USA')
insert
into employee values('C', 3, 15000,1000, 'England')
insert
into employee values('D', 4, 15000,1000, 'Canada')
insert
into employee values('E', 5, 15000,1000, 'New York')
insert
into employee values('F', 6, 15000,1000, 'Denmark')
select
* from employee
update
employee set name='spic', id=106, salary=1000, bonus=2000, address='Chd' where id=5
No comments:
Post a Comment