0% found this document useful (0 votes)
12 views

CT10 - Practical - Up To 17th March

Class

Uploaded by

rahulrai8047
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)
12 views

CT10 - Practical - Up To 17th March

Class

Uploaded by

rahulrai8047
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/ 11

09-03-2022

Database Tester Roles and Responsibiities-----

1.Table structure validation/Metadata Testing

- Validate database name as per SRS.

- Validate table name as per srs document.

- Validate total columns as per srs.

- Validate each column name from table as per srs.

- Validate the sequence of column

- Validate data type of each column as per srs

- Validate data type size/length of each column.

2. Will check the impact of front end application on backend..

Create Command----

create table CT10Info5(eid number(5), ename varchar2(20), Emob varchar2(14),Esal number(6),Ecity


varchar2(30), edept varchar2(15));

create table abcd ( eid number (7), empname varchar2(30), ecity varchar2(30) );

Q. How to display table info?----Ineterview Qusetion

---Yes Ofcourse. We use Describe command to display table info.

describe CT10Info;

10-03-2022
Insert Commands-- insert the rows/data into table.

101 Yusuf 9787878787 80000 Pune Bcom

insert into ct10info values (101, 'Yusuf', 9787878787, 80000, 'Pune', 'Bcom');

insert into ct10info values( 102,'Gaurav',9898987898,90000,'Amravati','cse');

insert into ct10info values( 103,'Mayur',9998987898,70000,'Mumbai','Mech');

insert into ct10info values( 104,'yusuf',8998987898,70000,'Mumbai','Mech');

select command- Display rows/rocords/data from table.

select * from ct10info ;

*= All rows/data/records

*** How to display perticular columns from table***

select ename from ct10info;

select ename,emob,esal from ct10info

select edept, ename from ct10info ;

********Database Engine/Sql Engine- who is responsible for your query execution.******

Table data is case sensitive.

Yusuf

yusuf
YUSUF

YusuF

All above names are different as table data will be case sentsitive.

12-03- 2022

Varchar2 dtattype scenario---

insert into ct10info values( 109,'YUSUF','+91-8998987898',70000,'Mumbai','Mech');

select * from ct10info ;

SQL Clauses----Where,group by ,having,order by

where---- It applies filter on table rows based on specific conditions.

SELECT * from ct10info where EID= 104;

SELECT EID,ENAME, ESAL from ct10info where EID= 104;

select * from ct10info where eid = 101;

select ename from ct10info where eid = 101;

select * from emp;

select * from ct10info where ename ='Priti';

SELECT * from ct10info where ename='Yusuf';

SELECT * from ct10info where ename='YUSUF';

SELECT * from ct10info where ename='yusuf';


SELECT * from ct10info where eadd='Pune';

SELECT * from ct10info where emob='9898987898';

101=104-- WILL NOT FILTER

104=104--- IT WILL FILTER THE ROWS BECZ CONDITION IS SATISFIED

13th Mar 2022

101 Yusuf 9787878787 80000 Pune Bcom

insert into ct10info values (101, 'Yusuf', 9787878787, 80000, 'Pune', 'Bcom');

111 Harsh 9087878787 60000 Delhi

insert into ct10info values (111,'Harsh','9087878787',60000,'Delhi'); It will show an error ---'not


enough values'

so we have other way to overcome this insert issue.

***Second way of inserting the rows using insert command***

insert into ct10info ( eid,ename,emob,esal,eadd) values (111,'Harsh','9087878787',60000,'Delhi');

select * from ct10info;


Null Values--- Null is value which we dont know what it is. i.e. an unknown value

insert into ct10info (eid, esal,ename) values( 125,750000,'Shivani');

insert into ct10info (eid) values( 126);

insert into ct10info (eid, esal,ename) values( 129,850000,''); no an ideal way

insert into ct10info (eid, esal) values( 130,950000);--ideal way

insert into ct10info (eid, esal,ename) values( 144,850000,' ');

insert into ct10info (eid, esal,ename) values( 145,850000,' ');

insert into ct10info (eid, esal,ename) values( 146,850000,'null'); it will accept 'null' the ename value
as actul name.

insert into ct10info (eid, esal,ename) values( 147,850000,''); --it will accept '' the ename values as
unknown value

This same concept goes with first insert method.

insert into ct10info values (141,'Harshali','8087878787',90000,'Delhi','')

'' ---- to define null value from user

' ', 'null', 'blank'--------wrong method to define null values.


insert into ct10info ( eid,ename,emob,esal,eadd, edept) values
(142,'Arsh','7087878787',80000,'Delhi','cse');

insert into ct10info ( eid,ename,emob,esal,eadd, edept) values


(143,'Priyanka','8097878787',80000,'it','Mumbai');

select * from ct10info;

14th March 2022

is null keyword---

It is used to identify null values from perticular column and display its resp. records from table.

common perception of candidates----

select * from ct10info where edept = '';------ it will not display null values... we will use is null
keyword.

Actual query

select * from ct10info where edept is null;---It will dipslay null values from edept column

select * from ct10info where ename= 'null';---It will display rows who havong ename = 'null'...i.e
'null' is a string

select * from ct10info where ename is null;

select * from ct10info where ename is not null;

Q. How to display null values from perticular column?--- Using is null keyword.

Update Command

Q. How to update salary with 120000 from table whose ename is 'Gaurav'.------Capgemini 3+years
Interview Quest.
update ct10info set esal= 120000 where ename ='Gaurav';

update ct10info

set esal= 120000

where ename ='Gaurav';

select * from ct10info;

Update ename with 'Tushar' whose eid is 104

update ct10info

set ename = 'Tushar'

where eid = 104;

update eadd with newyork where eadd is mumbai

update ct10info

set eadd = 'Newyork'

where eadd = 'Mumbai';

update emp

where ename='Sachin'

set esal=60000;-----------Wrong Query

How to update all employee salary with 80000?


update ct10info

set esal=80000

How to update esal with 125000 and eadd with 'Newyork' whose eid is 105

update ct10info

set esal=125000, eadd='Newyork'

where eid=105;

select * from ct10info

Q. How to update salry with null value whose name is 'Akash'?

Right Ans

update ct10info

set esal= ''

where ename ='Akash'

update ct10info

set esal= is null ya fir (null) ya fir 'null' -- these all comes under wrong syntaxes.

where ename ='Akash'

UPDATE EID WITH 108 WHOSE ENAME IS NULL.

UPDATE CT10INFO

SET EID= 108

WHERE ENAME IS NULL;


17-Mar-2022

Delete Command-- It deletes/removes rows from table with respect to given condition.

delete from CT10info where eid=111

select * from CT10info;

delete from ct10info where eid =108;

delete * from empinfo12345 where eid =103;---Wrong Query

delete from ct10info;

Is null keyword----It is used to identify null values from perticular column and display its resp.
records from table.

How to identify null values from your table?

select * from emp_info1234 where ecity is null;

select eid,ecity from emp_info1234 where ename is null;

select * from emp_info1234 where ename is null;

select * from emp_info1234 where ecity is not null;

How to delete null value rows from your table?

delete from ct10info where ename is null;

How to update the null values from table?

update employee11
set eincent=2000

where eincent is null;

select * from emp_info1234;

how to delete single column value from table?

delete esal from ct10info where eid=101; -----This is wrong query to delete single column value.

We will use Update command to solve this query.

update ct10info

set esal =''

where eid =101;

select * from ct10info

update eid with null values whose eadd is null.

update ct10info

set eid =''

where eadd is null;

SQL Operators-----

Arithmatic

Compariosn

Logical

Concatanition

Like

Set---Will cover in last session of sql.


1.Arithmatic

+, -, *, /

select * from employee11

select (esal+eincent) from employee11;

select eid,ename,ecity,(esal+eincent) as Total_Salary from employee11;-----Used Alias Concept for


esal+einncent column.

How to select total columns from table with addition of two columns?

select * , (esal+eincent) from employee11---It will not run

select employee11.* , (esal+eincent) as Total_Salary from employee11

select employee11.*,(esal+eincent) as Total_Salary from employee11 where eid=103 ;

select (esal-eincent) from employee11

select ename,eid,ecity,(esal-eincent) as Deducted_Salary from employee11;

select employee11.*,(esal-eincent) as Deducted_Salary from employee11;

select customer_info.*, (Total_bill_amt-Paid_bill_amt) as Due_bill_amt from customer_info;

select (esal*eincent)from employee11

select ename,eid,ecity,(esal*eincent) as TotalSalary from employee11;

select employee11.*,(esal*eincent) as TotalSalary from employee11;

select (esal/eincent) from employee11

select ename,eid,ecity,esal,eincent,(esal/eincent) as TotalSalary from employee11;

select employee11.*,(esal/eincent) as Total_Salary from employee11;

You might also like