Sie sind auf Seite 1von 43

DELHI PUBLIC SCHOOL VADODARA

INFORMATIC
S
PRACTICES
Acknowledgement
In the progression of completing this project
successfully, many people have bestowed upon us
their blessings and concrete support. We would like to
thank all the people who have been concerned with
this project.
Primarily, we would like to thank our principal Mr.
A.K. Sinha and our Informatics Practices teacher,
Mrs. Archana and express our earnest gratitude for
their imperative support, supervision and
encouragement without the aid of which this project
would not have come into view.
Additionally, we would like express a heartfelt thanks
to the technical staff for their perpetual support
during the making of this project.
Last but not the least we thank our benevolent friends
and parents for their persistent backing without which
we could not have overcome the impediments in the
assembly of this project.
TO DISPLAY DATE AND TIME ON LOGIN
PAGE:
getRootPane().setDefaultButton(jButton1);
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
{Calendar cal = Calendar.getInstance();
cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
time.setText(sdf.format(cal.getTime()));}
{Date now = new Date();
SimpleDateFormat formatter = new
SimpleDateFormat("dd/MM/yyyy");
date.setText( formatter.format( now ) );}
boolean
b=Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_
CAPS_LOCK);
if(b==true)
jLabel6.setText("CAPS LOCK IS ON");
else
jLabel6.setText("");}
}, 0, 1);
setLocationRelativeTo(null);

CODING ON LOGIN BUTTON


int Accesscode=0;
String user=N1.getText(),grade="";
String pwd=new String(N2.getPassword());
try{
Class.forName("java.sql.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://l
ocalhost/cnm","root","tiger");
Statement smt=con.createStatement();
String Query="select epassword,class,empid from employee
where euid='"+user+"';";
ResultSet rs=smt.executeQuery(Query);rs.next();
boolean a=rs.first();
if(a==true)
{String eno1=rs.getString(3);
if(rs.getString(1).equals(pwd))
{grade=rs.getString(2);
if(grade.equalsIgnoreCase("admin"))
Accesscode=1;
else if(grade.equalsIgnoreCase("manager"))
Accesscode=2;
else if(grade.equalsIgnoreCase("chef"))
Accesscode=3;
else if(grade.equalsIgnoreCase("cashier"))
Accesscode=4;
accessclass.accesscode=Accesscode;
accessclass.eno=eno1;
N1.setText("");N2.setText("");
new splashscreen().setVisible(true);
dispose();}
else
{Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,"ACCESS DENIED");
l1.setText("username or password may be incorrect");
}}
else if(a==false)
{Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,"ACCESS DENIED");
l1.setText("username or password may be incorrect"); }
smt.close();
con.close();
}
catch(Exception e){JOptionPane.showMessageDialog(null,
"error in connectivity pls contact IT support immediately");
}

CLASS FOR GRANTING ACCESS TO VARIOUS


EMPLOYEES:
public class accessclass {
public static int accesscode=0;
public static String eno="";

public static void main(String args[])


{}
}

SPLASHSCREEN FOR EFFECTS:

public splashscreen() {
initComponents();
setLocationRelativeTo(null);
p1.setValue(0);
final Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
p1.setValue(p1.getValue()+10);
if(p1.getValue()==100)
{timer.cancel();
dispose();
new access().setVisible(true);
} }}, 0, 100);
SNIPPET FOR GIVING ACCESS TO VARIOUS
USERS:
int ac=0;
String eno="";

public access() {
{ int x=0;

initComponents();setLocationRelativeTo(null);
admin.setEnabled(false);
ac=accessclass.accesscode;
eno=accessclass.eno;
System.out.println(eno);
if(ac==0)
{ JOptionPane.showMessageDialog(null,"SORRY...."+"\n
RIGHT NOW YOU DO NOT HAVE ANY ACCESS");
cm.setEnabled(false);
bill.setEnabled(false);
}
if (ac==1)
admin.setEnabled(true);
if (ac==2)
{}
if (ac==3)
{
cm.setEnabled(false);
}
if(ac==4)
{cm.setEnabled(false);
}
try{
Class.forName("java.sql.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://l
ocalhost/cnm","root","tiger");
Statement smt=con.createStatement();
String Query="select note from employee where
empid='"+eno+"';";
ResultSet rs=smt.executeQuery(Query);rs.next();
jTextArea1.setText(rs.getString(1));
con.close();
smt.close();
rs.close();
}
catch(Exception e){}}

CODING ON see my record BUTTON:


try{
Class.forName("java.sql.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://l
ocalhost/cnm","root","tiger");
Statement smt=con.createStatement();
String Query="select * from employee where
empid='"+eno+"';";
ResultSet rs=smt.executeQuery(Query);rs.next();
JOptionPane.showMessageDialog(null,"ename:
"+rs.getString(1)+"\n eid: "+rs.getString(2)+"\n contact no:
"+rs.getString(3)+"\n job: "+rs.getString(4)+"\n class:
"+rs.getString(5)+"\n payroll: "+rs.getString(6)+"\n userid:
"+rs.getString(7));
con.close();
smt.close();
rs.close();
} catch(Exception e){}

CODING ON stick it BUTTON:


String n=jTextArea1.getText();
try{
Class.forName("java.sql.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://l
ocalhost/cnm","root","tiger");
Statement smt=con.createStatement();
String Query="update employee set note ='"+n+"'
where empid='"+eno+"' ;";
smt.executeUpdate(Query);
System.out.println(Query);
con.close();
smt.close();
} catch(Exception e){}
CODING ON CHANGE BUTTON:
String eno=accessclass.eno;
if(l1.getText().equals("passwords match"))
{try{
Class.forName("java.sql.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://l
ocalhost/cnm","root","tiger");
Statement smt=con.createStatement();
String Query="select epassword from employee where
empid='"+eno+"';";
ResultSet rs=smt.executeQuery(Query);rs.next();
String op=rs.getString(1);
if(op.equals(new String(npwd.getPassword())))
{String np=new String (pwd1.getPassword());
smt.executeUpdate("update employee set
epassword='"+np+"' where empid='"+eno+"';");
JOptionPane.showMessageDialog(rootPane, "!!!PASSWORD
CHANGED!!!");}
else
JOptionPane.showMessageDialog(null, "Please enter correct
password");
dispose();
}

catch(Exception e){}}
KEYEVENTS FOR PASSWORD FIELD:

String pwd =new String(pwd1.getPassword());


String pwdr =new String(pwd2.getPassword());
if(pwd.equals("")||pwdr.equals(""))
{l1.setText("<html><c>please enter password <br>in
both the field</c></html>");
l1.setForeground(new java.awt.Color(255, 0, 0));}
else if(pwd.equals(pwdr)) {
l1.setText("passwords match");
l1.setForeground(new java.awt.Color(4,245,25));}
else{l1.setText("passwords don't match");
l1.setForeground(new java.awt.Color(255, 0, 0));}
CODING ON GO BUTTON:
DefaultTableModel tm=(DefaultTableModel)t1.getModel();
int R= tm.getRowCount();
for(int a=R;a>0;a--)
{tm.removeRow(0);}
t1.setModel(tm);
String name=en.getText();

try{
Class.forName("java.sql.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost/cnm","root","
tiger");
Statement smt=(Statement)con.createStatement();
String query="Select * from employee where ename like
'%"+name+"%' ;";
ResultSet rs=smt.executeQuery(query);
while(rs.next()){
tm.addRow(new Object[]
{rs.getString(1),rs.getString(2),rs.getLong(3),rs.getString(4),rs.get
String(5),rs.getLong(6),rs.getString(7),rs.getString(8),rs.getString(
9)});
;}}
catch (ClassNotFoundException ex) {
Logger.getLogger(empl.class.getName()).log(Level.SEVERE, null,
ex);
}catch (SQLException ex) {
JOptionPane.showMessageDialog(null,"error in
connectivity");

CODING ON SHOW ALL BUTTON:


DefaultTableModel tm=(DefaultTableModel)t1.getModel();
int R= tm.getRowCount();
for(int a=R;a>0;a--)
{tm.removeRow(0);}
t1.setModel(tm);

try{
Class.forName("java.sql.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost/cnm","roo
t","tiger");
Statement smt=(Statement)con.createStatement();
String query="Select * from employee ;";
System.out.println(1);
ResultSet rs=smt.executeQuery(query);
System.out.println(2);
while(rs.next()){
System.out.println(3);
tm.addRow(new Object[]
{rs.getString(1),rs.getString(2),rs.getLong(3),rs.getString(4),rs.
getString(5),rs.getInt(6),rs.getString(7),rs.getString(8),rs.getStri
ng(9),rs.getString(11)});
System.out.println(4);}
System.out.println(5);}

catch (ClassNotFoundException ex) {

Logger.getLogger(empl.class.getName()).log(Level.SEVERE,
null, ex);
}catch (SQLException ex) {
JOptionPane.showMessageDialog(null,"error in
connectivity"); }
CODING ON UPDATE BUTTON:

try{
Class.forName("java.sql.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost/cnm","roo
t","tiger");
Statement smt=(Statement)con.createStatement();
int a=t1.getRowCount();
int ans=JOptionPane.showConfirmDialog(null,"are you sure you
want to update records");
if(ans==JOptionPane.YES_OPTION){
for(int b=0;b<a;b++)
{
String nam = (String) t1.getValueAt(b, 0);
String id =(String) t1.getValueAt(b, 1);
Object contactno = t1.getValueAt(b, 2);
String job1 =(String) t1.getValueAt(b, 3);
String cl=(String) t1.getValueAt(b, 4);
Object sal =t1.getValueAt(b, 5);
String user =(String) t1.getValueAt(b, 6);
String pwd =(String) t1.getValueAt(b, 7);
String gender=(String) t1.getValueAt(b, 8);
String query="update employee set
ename='"+nam+"',contactno="+contactno+",job='"+job1+"',
class='"+cl+"',payroll="+sal+",euid='"+user+"',epassword='"
+pwd+"',gender='"+gender+"' where empid='"+id+"';";
System.out.println(1);
smt.executeUpdate(query);
System.out.println(2);
}
JOptionPane.showMessageDialog(null, "VOILA RECORDS
UPDATED!!!!");}
System.out.println(5);
smt.close();
con.close();}
catch (ClassNotFoundException ex) {

Logger.getLogger(empl.class.getName()).log(Level.SEVERE,
null, ex);
}catch (SQLException ex) {
JOptionPane.showMessageDialog(null,"error in
connectivity"); }

CODING ON DELETE COMMAND:


try{
Class.forName("java.sql.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost/cnm","roo
t","tiger");
Statement smt=(Statement)con.createStatement();
int a=t1.getRowCount();
int ans=JOptionPane.showConfirmDialog(null,"are you sure you
want to delete the record");
if(ans==JOptionPane.YES_OPTION){
String id =(String) t1.getValueAt(t1.getSelectedRow(), 1);
String query="delete from employee where empid='"+id+"';";
System.out.println(1);
smt.executeUpdate(query);
System.out.println(2);
JOptionPane.showMessageDialog(null, "VOILA RECORD
DELETED!!!!");}
System.out.println(5);
smt.close();
con.close();}
catch (Exception ex) {
JOptionPane.showMessageDialog(null,"error in
connectivity"); }

CODING ON KEYEVENT FOR NAME FIELD:


DefaultTableModel tm=(DefaultTableModel)t1.getModel();
int R= tm.getRowCount();
for(int a=R;a>0;a--)
{tm.removeRow(0);}
t1.setModel(tm);
String name=en.getText();
if(name.equals(""))
{}
else
try{
Class.forName("java.sql.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost/cnm","roo
t","tiger");
Statement smt=(Statement)con.createStatement();
String query="Select * from employee where ename like
'%"+name+"%' ;";
System.out.println(1);
ResultSet rs=smt.executeQuery(query);
System.out.println(2);
while(rs.next()){
System.out.println(3);

tm.addRow(new Object[]
{rs.getString(1),rs.getString(2),rs.getLong(3),rs.getString(4),rs.
getString(5),rs.getLong(6),rs.getString(7),rs.getString(8),rs.getS
tring(9)});
System.out.println(4);}
System.out.println(5);}

catch (Exception e) {

}
CODING ON CREATE BUTTON:
String pwd =new String(pwd1.getPassword());
String pwdr =new String(pwd2.getPassword());
String chk =l1.getText();
if(ename.getText().equals("")|| eid.getText().equals("")||
contact_no.getText().equals("")|| job.getText().equals("")||
payroll.getText().equals("")|| userid.getText().equals("")||
pwd.equals("")||pwdr.equals("")||
classq.getSelectedItem().equals(" "))
{JOptionPane.showMessageDialog(null, "please fill all
fields");}
String Gender=(String) gen.getSelectedItem();
String nam =ename.getText();
String id =eid.getText();
long contactno =Long.parseLong(contact_no.getText());
String job1 =job.getText();
String cl=(String) classq.getSelectedItem();
int sal =Integer.parseInt(payroll.getText());
String user =userid.getText();
if(chk.equals("passwords match")) {
try {
Class.forName("java.sql.Driver");

Connection con=
(Connection)DriverManager.getConnection("jdbc:mysql://localh
ost/cnm","root","tiger");

Statement smt=(Statement)con.createStatement();
String query="insert into employee
values('"+nam+"','"+id+"',"+contactno+",'"+job1+"','"+cl+"',"
+sal+",'"+user+"','"+pwd+"','"+Gender+"','',curdate());";
smt.execute(query);
JOptionPane.showMessageDialog(null,"voila new
employee registered");
dispose();

} catch (Exception e) {
JOptionPane.showMessageDialog(null,e);
JOptionPane.showMessageDialog(null,"CONTACT IT
SUPPORT IMMEDIATELY");
}
}

CODE TO SET ENABLE CREATE BUTTON :


String pwd =new String(pwd1.getPassword());
String pwdr =new String(pwd2.getPassword());
String chk =l1.getText();
if(ename.getText().equals("")|| eid.getText().equals("")||!
(cil.getText().equals(""))|| job.getText().equals("")||
payroll.getText().equals("")|| userid.getText().equals("")|| !
l1.getText().equals("passwords match"))
{CREATE.setEnabled(false);}
else
CREATE.setEnabled(true);
CODING ON KeyReleasedEvent OF
PASSWORD TEXTFIELD:

String pwd =new String(pwd1.getPassword());


String pwdr =new String(pwd2.getPassword());
if(pwd.equals("")||pwdr.equals(""))
{l1.setText("<html><c>please enter password <br>in
both the field</c></html>");
l1.setForeground(new java.awt.Color(255, 0, 0));}
else if(pwd.equals(pwdr)) {
l1.setText("passwords match");
l1.setForeground(new java.awt.Color(81,173,51));}
else{l1.setText("passwords don't match");
l1.setForeground(new java.awt.Color(255, 0, 0));}

CODING ON KEYRELEASED EVENT OF NAME


TEXTFIELD:
char c=evt.getKeyChar();
if(!(Character.isLetter(c)||c==KeyEvent.VK_SPACE))
evt.consume();

CODING ON KEYRELEASED EVENT OF


CONTACT TEXTFIELD:
char c=evt.getKeyChar();
if(!(Character.isDigit(c)||c==KeyEvent.VK_SPACE)||
contact_no.getText().length()==10){

evt.consume(); }
int a=contact_no.getText().length();
if(a<10)
cil.setText("please ensure contact no. is of 10 digits");
else
cil.setText("");

KEYEVENT FOR PAYROLL TEXTFIELD:


char c=evt.getKeyChar();
if(!(Character.isDigit(c)||c==KeyEvent.VK_SPACE)||
payroll.getText().length()==6)
evt.consume();

CODING ON KEYRELEASED EVENT OF NAME


TEXTFIELD:
DefaultTableModel cb=(DefaultTableModel) jTable1.getModel();
String a=jTextField1.getText();
if(a.equals(""))
{for(int c=cb.getRowCount();c>0;c--)
cb.removeRow(0);}
else{
for(int c=cb.getRowCount();c>0;c--)
cb.removeRow(0);
try{
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost/cni
m","root","tiger");
Statement smt=conn.createStatement();
String query="select * from cmtmgmt where cname
like'"+a+"%';";
ResultSet rs=smt.executeQuery(query);
while(rs.next())
{Object b[]=
{rs.getString(1),rs.getString(2),rs.getString(3)} ;
cb.addRow(b);System.out.println(2);}
conn.close();
smt.close();
rs.close();} catch(Exception e)
{JOptionPane.showMessageDialog(null,"error in connection");}}

TO ADD A NEW CUSTOMER THROUGH NEW


BUTTON:
int r=jTable1.getSelectedRow();
String a=(String) jTable1.getValueAt(r, 0);
String b=(String) jTable1.getValueAt(r, 2);
billdet.customername=a;
billdet.customerno=b;

System.out.println(billdet.customername+billdet.customerno);
new billing().setVisible(true);
dispose();
CODING ON CREATE AND PROCEED
BUTTON:

try {
String name = n1.getText();
String conno = n2.getText();
String email = n3.getText();
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/cnim",
"root", "tiger");
Statement smt = con.createStatement();
smt.executeUpdate("insert into cmtmgmt values('" +
name + "','" + email + "'," + conno + ");");
con.close();
smt.close();
billdet.customername=name;
billdet.customerno=conno;
dispose();
new billing().setVisible(true);
} catch (Exception ex) {System.out.print(ex);}

CODING ON KEYTYPED EVENT OF CONTACT


TEXTFIELD:

char c=evt.getKeyChar();
if(!(Character.isDigit(c)||c==KeyEvent.VK_SPACE)||
n2.getText().length()==10){

evt.consume(); }
int a=n2.getText().length();
if(a<10)
cil.setText("please ensure contact no. is of 10 digits");
else
cil.setText("");
CODING ON KEYRELEASED EVENT FOR
NAME TEXTFIELD:

String a=t1.getText();
String b=t2.getText();
DefaultTableModel tm1=(DefaultTableModel)
jTable1.getModel();
while(tm1.getRowCount()>0)
tm1.removeRow(0);
try{
Class.forName("java.sql.Driver");
Connection
conn1=DriverManager.getConnection("jdbc:mysql://localhost/pr
oducts","root","tiger");
Connection
conn2=DriverManager.getConnection("jdbc:mysql://localhost/pr
oducts","root","tiger");
Statement smt1=conn1.createStatement();
Statement smt2=conn2.createStatement();
String query1="show tables ;",query2="";
ResultSet rs1=smt1.executeQuery(query1);
while(rs1.next()){
query2="select*from "+rs1.getString(1)+" where item
like'"+a+"%';";
ResultSet rs2=smt2.executeQuery(query2);

while(rs2.next())
tm1.addRow(new Object[] {rs2.getString(2),rs2.getString(1)});
}
}
catch(Exception e){System.out.print(e);}

CODING ON ADD TO BILL BUTTON:


String ss = JOptionPane.showInputDialog("Enter the quantity");
int sss1;
if(ss.equals(""))
sss1=1;
else
sss1=Integer.parseInt(ss);
String
r=(String)jTable1.getValueAt(jTable1.getSelectedRow(), 1);
DefaultTableModel tm1=(DefaultTableModel)
jTable2.getModel();

try{
Connection
conn1=DriverManager.getConnection("jdbc:mysql://localhost/pr
oducts","root","tiger");
Connection
conn2=DriverManager.getConnection("jdbc:mysql://localhost/pr
oducts","root","tiger");
Statement smt1=conn1.createStatement();
Statement smt2=conn2.createStatement();
String query1="show tables ;",query2="";
ResultSet rs1=smt1.executeQuery(query1);

while(rs1.next()){
query2="select * from "+rs1.getString(1)+" where
ino='"+r+"';";

ResultSet rs2=smt2.executeQuery(query2);
while(rs2.next())
{total1=total1+sss1*rs2.getInt(3);

tm1.addRow(new Object[]
{rs2.getString(2),sss1,rs2.getInt(3),sss1*rs2.getInt(3)});
}}total.setText(""+total1);}

catch(Exception e){System.out.print(e);}

CODING ON REMOVE BUTTON:


int a=jTable2.getSelectedRow();
DefaultTableModel tm1=(DefaultTableModel)
jTable2.getModel();

Object c1 = tm1.getValueAt(a, 3);

JTextField ta1= new JTextField();


ta1.setText(""+c1);
tm1.removeRow(a);
int c = Integer.parseInt(ta1.getText());
total1=total1-c;
total.setText(""+total1);

CODING ON BILL IT BUTTON:


String r = " use invoices";
DefaultTableModel tm1=(DefaultTableModel)
jTable2.getModel();
for(int x=0; x<tm1.getRowCount();x++)
{JTextField fx = new JTextField();
fx.setText(""+tm1.getValueAt(x, 0));
billdet.A[x]=fx.getText();
fx.setText(""+tm1.getValueAt(x, 1));
billdet.B[x]=fx.getText();
fx.setText(""+tm1.getValueAt(x, 2));
billdet.C[x]=fx.getText();
fx.setText(""+tm1.getValueAt(x, 3));
billdet.D[x]=fx.getText();
billdet.E=tm1.getRowCount();
}

int x=tm1.getRowCount();String
c=billdet.customername;String d=billdet.customerno;
try{
Class.forName("java.sql.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://l
ocalhost/cnim","root","tiger");
Connection
con1=(Connection)DriverManager.getConnection("jdbc:mysql://
localhost/cnim","root","tiger");
Statement smt=con.createStatement();
Statement smt1=con1.createStatement();
billdet.totalamt=total1;

String aa= "insert into invoices values (truncate((now()


+0),0),'"+c+"',"+d+","+billdet.totalamt+",curdate(),curtime());
";
smt.execute(aa);

ResultSet rs1=smt.executeQuery("select * from invoices ;");


rs1.last();
billdet.invoiceno=rs1.getString(1);

dispose();
new billpreview().setVisible(true);
}catch(Exception e){
System.out.println(e); }

CLASS FOR BILLING FORM:


import javax.swing.table.DefaultTableModel;
public class billdet {
public static String customername="anonymous";
public static String customerno="0000000000";
public static DefaultTableModel tm1;
static int totalamt;
static String invoiceno;
static String [] A=new String[1000];
static String [] B=new String[1000];
static String [] C=new String[1000];
static String [] D=new String[1000];
static int E;
public static void main(String args[])
{}
}
CODING FOR EXTRACTING BILL DATA FROM
BILL CLASS:
public class billpreview extends javax.swing.JFrame {
public billpreview() {
initComponents();
jTextArea1.append("Customer Name : "+billdet.customername
+ "\n Mobile number : "+ billdet.customerno );
jTextArea1.append(" \n Invoice number : " +
billdet.invoiceno +"\n\nBilling details\n\n");
jTextArea1.append("Item Name Quatity
Rate Amount \n ");
for(int x=0; x<billdet.E;x++)
{ jTextArea1.append("\n"+billdet.A[x].substring(0,6)+"
"+billdet.B[x]+" "+billdet.C[x]+"
"+billdet.D[x]);
}
jTextArea1.append("\n
Total Amount="+billdet.totalamt);}

CODING ON PRINT BILL BUTTON:


try{jTextArea1.print();
}catch(PrinterException e){}
MySQL QUERIES FOR CREATING
DATABASE AND TABLES USED
create database cnm;
use cnm;
create table employee
(ename varchar(25),
empid varchar(10) primary key ,
contactno bigint(10) unique,
job varchar(10),
class varchar(10) check class
in(none,admin,manager,chef,cashier),
payroll int(7),
euid varchar(10) unique,
epassword varchar(10) unique,
gender char(1) check gender in(M,F),
note varchar(500)
doj date);

insert into employee


values("Himanshu","qwerty",9712927832,"defined","admin",20
0000,"p2","ppp2","m","WElcome");
insert into employee
values("BRAVOBOY","007",987654638,"defined","admin",20000
0,"p1","ppp1","m","WElcome BROTHER MINE");

create table

discussionforum
(discussed varchar(50),
name varchar(25),
empid varchar(10),
date date);

create
database
cnim;
use cnim;
create table
cmtmgmt
(cname
varchar(10),

emailid varchar(30),

cno int(10),

unique(cname,cno));

create table invoices


(invoiceno
varchar(40)
primary key,
custname
varchar(25) not
null,
custno
varchar(10),
billamt int(10),
date date,
time time);

DATABASE : PRODUCTS
create database products;
use products

TABLE : INDEPENDENT
create table independent
(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into independent values('i1',"taco 4
piece",50,5000,'2016-01-01');
insert into independent values('i2',"taco 2
piece",30,5000,'2016-01-01');
insert into independent values('i3',"Waffle
Cone",10,5000,'2016-01-01');
insert into independent values('i4',"Waffle Cup",10,5000,'2016-
01-01');
insert into independent values('i5',"Smokey
Biscuit",10,5000,'2016-01-01');
insert into indeoendent values('i6',"Pop corn
icecream",50,5000,'2016-01-01');
insert into independent values('i7',"Cheeseling
icecream",50,5000,'2016-01-01');
insert into independent values('i8',"Foggy Hand
Wash",5,5000,'2016-01-01');
insert into independent values('i9',"Self Expanding
Balloon",10,5000,'2016-01-01');

TABLE : PANICECREAM

create table panicecream


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into panicecream values('pi1',"Orange
Rolls",60,5000,'2016-01-01');
insert into panicecream values('pi2',"Strawberry
rolls",60,5000,'2016-01-01');
insert into panicecream values('pi3',"Mango
Rolls",60,5000,'2016-01-01');
insert into panicecream values('pi4',"Black Currant
Rolls",60,5000,'2016-01-01');
insert into panicecream values('pi5',"Litchi
Rolls",60,5000,'2016-01-01');
insert into panicecream values('pi6',"Guava
rolls",60,5000,'2016-01-01');
insert into panicecream values('pi7',"Kiwi rolls",70,5000,'2016-
01-01');

TABLE : DRYFRUITROLLS

create table dryfruitrolls


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into dryfruitrolls values('dfr1',"Chocolate
cashew",70,5000,'2016-01-01');
insert into dryfruitrolls values('dfr2',"Almond
Carnival",70,5000,'2016-01-01');
insert into dryfruitrolls values('dfr3',"Oreo",70,5000,'2016-01-
01');
insert into dryfruitrolls values('dfr4',"Pistachio",80,5000,'2016-
01-01');
insert into dryfruitrolls values('dfr5',"Anjir Kaju",80,5000,'2016-
01-01');
insert into dryfruitrolls values('dfr6',"Nutella",80,5000,'2016-01-
01');

TABLE : REALFRUITICECREAM
create table Realfruiticecream
(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into Realfruiticecream
values('rfi1',"Banana",70,5000,'2016-01-01');
insert into Realfruiticecream
values('rfi2',"Apple",80,5000,'2016-01-01');
insert into Realfruiticecream
values('rfi3',"Orange",80,5000,'2016-01-01');
insert into Realfruiticecream
values('rfi4',"Strawberry",80,5000,'2016-01-01');
insert into Realfruiticecream
values('rfi5',"Kiwi",100,5000,'2016-01-01');
insert into Realfruiticecream
values('rfi6',"Mango",100,5000,'2016-01-01');

TABLE : BALLICECREAM
create table ballicecream
(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into ballicecream values('bice1',"Banana",60,5000,'2016-
01-01');
insert into ballicecream values('bice2',"Cotton
candy",60,5000,'2016-01-01');
insert into ballicecream values('bice3',"Orange",60,5000,'2016-
01-01');
insert into ballicecream
values('bice4',"Strawberry",60,5000,'2016-01-01');
insert into ballicecream
values('bice5',"Raspberry",60,5000,'2016-01-01');
insert into ballicecream values('bice6',"Mango",60,5000,'2016-
01-01');
insert into ballicecream values('bice7',"Black
currant",60,5000,'2016-01-01');
insert into ballicecream
values('bice8',"Chocolate",60,5000,'2016-01-01');
insert into ballicecream
values('bice9',"Vanilla+Oreo",60,5000,'2016-01-01');
insert into ballicecream
values('bice10',"Blueberry",60,5000,'2016-01-01');
TABLE : LIQNITROICECREAM

create table liqnitroicecream


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into liqnitroicecream
values('liqn1',"Cashew",70,5000,'2016-01-01');
insert into liqnitroicecream values('liqn2',"Almond
candy",70,5000,'2016-01-01');
insert into liqnitroicecream values('liqn3',"Oreo",70,5000,'2016-
01-01');
insert into liqnitroicecream
values('liqn4',"Gems",70,5000,'2016-01-01');
insert into liqnitroicecream
values('liqn5',"Kitkat",70,5000,'2016-01-01');
insert into liqnitroicecream values('liqn6',"Pista",80,5000,'2016-
01-01');
insert into liqnitroicecream values('liqn7',"Anjir",80,5000,'2016-
01-01');
insert into liqnitroicecream
values('liqn8',"Nutella",80,5000,'2016-01-01');
insert into liqnitroicecream
values('liqn9',"Snickers",80,5000,'2016-01-01');
TABLE : ICECANDY

create table icecandy


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into icecandy values('ic1',"Ral
Strawberry",30,5000,'2016-01-01');
insert into icecandy values('ic2',"Real Orange",30,5000,'2016-
01-01');
insert into icecandy values('ic3',"Mango",20,5000,'2016-01-
01');
insert into icecandy values('ic4',"Kala Khatta",20,5000,'2016-
01-01');
TABLE : SANDWICH

create table sandwich


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into sandwich values('sw1',"club",100,5000,'2016-01-
01');
insert into sandwich values('sw2',"Cheezy
patties",100,5000,'2016-01-01');
insert into sandwich values('sw3',"Shanghai",100,5000,'2016-
01-01');
insert into sandwich values('sw4',"Fried
Eggplant",100,5000,'2016-01-01');
insert into sandwich values('sw5',"HAkka
noddles",70,5000,'2016-01-01');
insert into sandwich values('sw6',"Itza Grilled",70,5000,'2016-
01-01');
insert into sandwich values('sw7',"Grilled Galoti
patties",80,5000,'2016-01-01');
insert into sandwich values('sw8',"Grilled veg",80,5000,'2016-
01-01');
insert into sandwich values('sw9',"Corn and
cucumber",80,5000,'2016-01-01');
insert into sandwich values('sw10',"Tandoori
Mushroom",100,5000,'2016-01-01');
insert into sandwich values('sw11',"Tandoori Paneer
grilled",100,5000,'2016-01-01');
insert into sandwich values('sw12',"Grilled tomato
sandwich",100,5000,'2016-01-01');

TABLE : WAFFLE

create table waffle


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into waffle values('waf1',"Nutella",100,5000,'2016-01-
01');
insert into waffle values('waf2',"Icecream",100,5000,'2016-01-
01');
insert into waffle values('waf3',"Peanut Butter",100,5000,'2016-
01-01');
insert into waffle values('waf4',"Fried
Eggplant",100,5000,'2016-01-01');
insert into waffle values('waf5',"Real Banana",70,5000,'2016-
01-01');
insert into waffle values('waf6',"Real
Strawberry",70,5000,'2016-01-01');
insert into waffle values('waf7',"Bubble Waffle",80,5000,'2016-
01-01');

TABLE : BEVERAGES

create table beverages


(ino varchar(10) primary key,
item varchar(70) not null,
sellprice int(10),
instock long,
lastsold date);
insert into beverages values('bev1',"Assam tea",20,5000,'2016-
01-01');
insert into beverages values('bev2',"MAsala
tea",20,5000,'2016-01-01');
insert into beverages values('bev3',"Ginger tea",20,5000,'2016-
01-01');
insert into beverages values('bev4',"Cardamon",20,5000,'2016-
01-01');
insert into beverages values('bev5',"Lemon tea",25,5000,'2016-
01-01');
insert into beverages values('bev6',"Green Tea",25,5000,'2016-
01-01');
insert into beverages values('bev7',"Hot
chocolate",30,5000,'2016-01-01');
insert into beverages values('bev8',"Cappucino
coffee",30,5000,'2016-01-01');
insert into beverages values('bev9',"Expresso
coffee",30,5000,'2016-01-01');
insert into beverages values('bev10',"Latte
coffee",30,5000,'2016-01-01');

BIBLIOGRAPHY:
1.Sumita Arora Cbse Class XI
2. Sumita Arora Cbse Class XII
3.stackoverflow.com

Das könnte Ihnen auch gefallen