Professional Documents
Culture Documents
AjaraMahavidyalaya ,Ajara
Dist Kolhapur
Department Of BCA
Certificate
This is to certify that Shri/Miss – Maskar Sopan Tanajil has satisfactorily completed to
course of practical in computer prescribed by the Shivaji University Kolhapur for B.C.A I / II / III
Sem. I /II /III/IV/V/VI during the year 2022-2023.
Simple Queries
4 Perform
String functions
Maths functions
Date functions
Department Of BCA
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sample |
+--------------------+
+--------------------+
| Database |
+--------------------+
| information_schema |
| bca2 |
| mysql |
| performance_schema |
| sample |
+--------------------+
Database changed
mysql> create table employee( empid int (4), emp_name varchar (10));
+----------------+
| Tables_in_bca2 |
+----------------+
| employee |
+----------------+
+-------+----------+
| empid | emp_name |
+-------+----------+
| 1001 | ganesh |
| 1002 | ramesh |
| 1004 | ratna |
| 1003 | jyostna |
| 1005 | rama |
+-------+----------+
mysql> create table clientmaster( clientno varchar(6),name varchar(20), address1 varchar(15), address2
varchar(15),city varchar(15), pincode int (8),state varchar(15), baldue float (10,2));
+----------+-------------+------+-----+---------+-------+
+----------+-------------+------+-----+---------+-------+
+----------+-------------+------+-----+---------+-------+
+----------+---------------+----------+----------+----------+---------+-------------+----------+
+----------+---------------+----------+----------+----------+---------+-------------+----------+
+----------+---------------+----------+----------+----------+---------+-------------+----------+
+----------+---------------+----------+----------+----------+---------+-------------+----------+
+----------+---------------+----------+----------+----------+---------+-------------+----------+
+----------+---------------+----------+----------+----------+---------+-------------+----------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
mysql> commit;
Department Of BCA
+----------+-------------+------+-----+---------+-------+
+----------+-------------+------+-----+---------+-------+
+----------+-------------+------+-----+---------+-------+
+----------------+
| Tables_in_bca2 |
+----------------+
| clientmaster |
| employee2 |
+----------------+
+--------------------------------------------------+
+--------------------------------------------------+
+--------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+
| GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES,
LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON
`bca2`.* TO 'bca123'@'%' |
+----------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------+
| GRANT INSERT, UPDATE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK
TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `bca2`.*
TO 'bca123'@'%' |
+----------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------+
+------------------------------------+
+------------------------------------+
+------------------------------------+
Department Of BCA
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+--------+-----------+------------+-----------+
+--------+-----------+------------+-----------+
+--------+-----------+------------+-----------+
+---------------+----------+-------------+
+---------------+----------+-------------+
+---------------+----------+-------------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+----------+---------------+----------+----------+----------+---------+-------------+---------+
+--------------+
| AVG BAL |
+--------------+
| 99500.000000 |
+--------------+
+----------+
| MIN BAL |
+----------+
| 10000.00 |
+----------+
+-----------+
| Max BAL |
+-----------+
| 300000.00 |
+-----------+
+-----------+
| TOTAL BAL |
+-----------+
| 995000.00 |
+-----------+
mysql> select city, count(acc_n0) "NO OF ACCOUNTS" from acc_master group by city;
+------------+----------------+
| city | NO OF ACCOUNTS |
+------------+----------------+
| ajara | 4|
| gadhingla | 2|
| inchnal | 1|
| paroli | 1|
| polgaon | 1|
| uttur | 1|
+------------+----------------+
+------------+-----------+-----------+
+------------+-----------+-----------+
| ajara | om | 100000.00 |
+------------+-----------+-----------+
+------------+-----------+
| city | TOTAL |
+------------+-----------+
| ajara | 240000.00 |
| gadhingla | 600000.00 |
| inchnal | 60000.00 |
| paroli | 25000.00 |
| polgaon | 50000.00 |
| uttur | 20000.00 |
+------------+-----------+
+------------+-----------+
| city | MINBAL |
+------------+-----------+
| ajara | 10000.00 |
| gadhingla | 300000.00 |
| inchnal | 60000.00 |
| paroli | 25000.00 |
| polgaon | 50000.00 |
| uttur | 20000.00 |
+------------+-----------+
mysql> select city, sum(balance)as total from acc_master group by city having sum(balance)>100000;
+------------+-----------+
| city | total |
+------------+-----------+
| ajara | 240000.00 |
| gadhingla | 600000.00 |
+------------+-----------+
2 rows in set (0.01 sec)
mysql> select city, max(balance) as MAXBAL from acc_master group by city having max(balance)<50000;
+---------+----------+
| city | MAXBAL |
+---------+----------+
| paroli | 25000.00 |
| uttur | 20000.00 |
+---------+----------+
+------------+-----------+
| city | MINBAL |
+------------+-----------+
| gadhingla | 300000.00 |
| inchnal | 60000.00 |
| paroli | 25000.00 |
| polgaon | 50000.00 |
| uttur | 20000.00 |
+------------+-----------+
Department Of BCA
String functions
Maths functions
Date functions
+----------+
| pow(3,2) |
+----------+
| 9|
+----------+
+----------+
| abs(-14) |
+----------+
| 14 |
+----------+
+------------+
| ceil(14.6) |
+------------+
| 15 |
+------------+
+-------------+
| floor(14.6) |
+-------------+
| 14 |
+-------------+
+-------------+
| mod (25, 3) |
+-------------+
| 1|
+-------------+
+-----------+
| sqrt (25) |
+-----------+
| 5|
+-----------+
Department Of BCA
.
mysql> select * from department;
+--------+----------+
| deptid | deptname |
+--------+----------+
| 5001 | informat |
| 5002 | human re |
| 5003 | marketin |
| 5004 | administ |
| 5005 | finance |
+--------+----------+
+-------+----------+--------+
+-------+----------+--------+
+-------+----------+--------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
+-------+----------+----------+
Department Of BCA
.
mysql> select distinct(e. emp_name) from employee e, department d where d.deptname in (e.deptid=d.deptid);
+----------+
| emp_name |
+----------+
| anita |
| sunita |
| suresh |
| ramesh |
| satish |
| saina |
| priyali |
| anil |
| manali |
| prayag |
| prachi |
+----------+
HAVE TO COMPLETE
mysql> select *from employee;
+--------+-----------+---------+------------+---------+
+--------+-----------+---------+------------+---------+
+--------+-----------+---------+------------+---------+
Department Of BCA
mysql> select emp_id, emp_name from employee where emp_id> any(select emp_id from department);
+--------+-----------+
| emp_id | emp_name |
+--------+-----------+
| 102 | mark |
| 103 | donald |
| 104 | obama |
| 105 | linklon |
| 106 | kane |
| 107 | adam |
| 108 | macculam |
| 109 | brayan |
| 110 | stefen |
| 111 | alexander |
+--------+-----------+
AjaraMahavidyalaya, Ajara
Department Of BCA
.
mysql> select *from employee;
+--------+-----------+---------+------------+---------+
+--------+-----------+---------+------------+---------+
+--------+-----------+---------+------------+---------+
+--------+-----------+
| emp_id | emp_name |
+--------+-----------+
| 106 | kane |
| 111 | alexander |
+--------+-----------+
mysql> alter view employee1 as select emp_id, emp_name from employee where emp_age<40;
+--------+----------+
| emp_id | emp_name |
+--------+----------+
| 101 | peter |
| 102 | mark |
| 104 | obama |
| 105 | linklon |
| 107 | adam |
+--------+----------+
AjaraMahavidyalaya, Ajara
Department Of BCA
+------+---------+--------+
| id | name | class |
+------+---------+--------+
| 1 | deepa | M.C.A. |
| 2 | deepak | B.C.A. |
| 3 | seeta | M.C.A. |
| 4 | rahul | B.C.A. |
| 5 | ratan | M.C.A. |
| 6 | sanjeev | B.C.A. |
| 7 | diyva | B.C.A. |
| 8 | reena | M.C.A. |
+------+---------+--------+
mysql> commit;
->
-> begin
->
->
->
->
->
->
->
->
->
->
->
-> set name_list= concat(s_nm, ";",name_list);
->
->
->
-> end $$
-> $$
-> $$
-> $$
+------------------------------------------------------+
| @name_list |
+------------------------------------------------------+
| reena;diyva;sanjeev;ratan;rahul;seeta;deepak;deepa; |
+------------------------------------------------------+
Department Of BCA
mysql> insert into employee values(01, 'rohan', 'scientist', '2020-10-04',12); Query OK, 1 row affected (0.01 sec)
mysql> insert into employee values(02, 'sujal', 'engineer', '2020-10-04',10); Query OK, 1 row affected (0.01 sec)
mysql> delimiter $$
->
->
-> begin
->
->
->
-> end
-> $$
-> $$
+--------+---------+-------------+---------------+---------------+
+--------+---------+-------------+---------------+---------------+
+--------+---------+-------------+---------------+---------------+
-> $$
+---------------------------------------+--------+----------+--------------------------------------------------------------------------------------
----+--------+---------+----------+----------------+----------------------+----------------------+--------------------+
+---------------------------------------+--------+----------+--------------------------------------------------------------------------------------
----+--------+---------+----------+----------------+----------------------+----------------------+--------------------+
end if;
end | BEFORE | NULL | | root@localhost | utf8 | utf8_general_ci | latin1_swedish_ci |
+---------------------------------------+--------+----------+--------------------------------------------------------------------------------------
----+--------+---------+----------+----------------+----------------------+----------------------+--------------------+