Tuesday, 31 January 2017

Is it possible that I can query for names of all tables which contain column with name

SELECT COLUMN_NAME AS 'ColumnName' ,TABLE_NAME AS 'TableName' FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%MyName%' ORDER BY TableName,ColumnName;


Refer:  http://stackoverflow.com/questions/4849652/find-all-tables-containing-column-with-specified-name 

Monday, 30 January 2017

Windows Powershell command to list files greater than 500 MB size in any drive

Launch powershell as administrator.

Get-ChildItem -Path C:\ -Recurse | Where-Object {$_.length/1MB -gt 500} | select fullname,@{n=”Size MB”;e={$_.length/1MB}} 



Thursday, 18 August 2016

How to truncate transaction log file of a database in SQL Server

Cleaning templog  (tempdb transaction log file):
 
dbcc shrinkfile ('templog',0)

To look for  .mdf and .ldf  files and their locations. Use below statement:


select  *  from sys.database_files

Wednesday, 8 June 2016

How to kill SQL DB connections and bring it to offline and online back

ALTER DATABASE [Test]
SET OFFLINE WITH ROLLBACK IMMEDIATE

ALTER DATABASE [Test]
SET ONLINE



In the Object Explorer tree drill down under Management to "Activity Monitor" (if you cannot find it there then right click on the database server and select "Activity Monitor"). Opening the Activity Monitor, you can view all process info. You should be able to find the locks for the database you're interested in and kill those locks, which will also kill the connection.



ref:  http://stackoverflow.com/questions/11620/how-do-you-kill-all-current-connections-to-a-sql-server-2005-database

Sunday, 15 November 2015

Oracle 10g SQL as it is from QSpiders

SQL Statements:DDL: create,alter,rename,drop and truncate.DML: insert,update and delete.DCL: grant,revoke.TCL: commit,rollback,savepoint. DQL: select
How to insert multiple rows into a table:

insert into emp values(&empid,&ename,&salary);  

update emp set salary = 10000 where ename = 'john';

delete from emp where ename = 'john';

create table  emp ( eid  number(4), ename varchar2(10). salary number(10));

alter table emp add dept number(4);

To rename a column: alter table emp rename column salary to newsalary;

drop table emp;

DDL commands are auto saved. 

select * from dual;    - shows dummy table. 

truncate table emp;  - deletes the data from table permanently. truncate is a DDL command as it is a autosave command. Also, it is DML because it deals with data.

commit; - saves the user action till that point.

rollback; - it will undo the user action to previous successfully saved status.

savepoint; - it is an instant save for the user action for that particular section.

example: insert 2 rows into emp;  - savepoint sp1
               update 1 row into emp;  - savepoint sp2
               insert 1 row into emp;   - savepoint sp3
               rollback to sp2; takes to last saved state until savepoint sp2.

grant  select,insert,update on emp to scott;

revoke select,insert,update on emp from scott;

Constraints: are conditions or limitations on the table.
Types: Not Null, unique, primary key, foreign key, check.

Not Null: does not allow null values. 
example: create table emp( empid number(4) unique);

Primary Key: It is used for maintaining the relation between two tables.
Also, it is a condition or limitation on the table.
In a single table, we can apply one pk.

create table emp(empid number(2), salary number(5), ename varchar2(10) ,deptid number(2),
         constraint emp_pk  primary key(empid), constraint dept_key foreign key(deptid) references dept(deptid));

Foriegn Key: It is a referential integrity key between two tables.
A table can contain one or more foreign keys. Foreign key will allow null values and duplicate values.

Check constraint: It is a constraint or condition or limitation on a table. It  will enforce the users to validate the data before storing in the database.

example: create table emp(empid number(2), salary number(5), ename varchar2(10), constraint emp_chk  check(salary > 500));

Logical,relational,special operators like 'like', in , between and is.

Set Operators:

Union: It returns all the unique values from both the tables.
Union all: It returns all the values from both the tables.
Intersect: It returns all the values common in both the tables.
Minus: It returns values which are there in one table but not there in another table.

NVL: It is a function used for handling null values while performing arithmetic operations.

select sal,comm, sal + NVL(comm,0) as "Total Sal" from emp;

- To do - functions 

 select statement syntax:
- select * from table where groupy having orderby 

- To do - views

- Indexes are used for quick retrieval of data.

create index <indexname>  on table name (colname) ; 
drop index <index name>;

- To do - Normalization.

- To do - subqueries.

- Joins: are used for fetching the data from more than one table. To write a join, two tables must have a common column.
Types of Joins:
a. Inner Join
b. Outer Join
c. Self Join

- Inner Join is used in order to fetch matched records from both the tables.

example:
select * from table1 inner join table2 on 
                              table1.commoncolumn = table2.commoncolumn;

- Outer Join

a.Left Outer Join
b.Right Outer Join
c.Full Outer Join

Left Outer Join:

select * from table1 left outer join table2 on 
                              table1.commoncolumn = table2.commoncolumn;

fetches matched records from both the  tables and non matched records from left side table.

b. Right Outer Join:
select * from table1 right outer join table2 on 
                              table1.commoncolumn = table2.commoncolumn;

fetches matched records from both the  tables and non matched records from right side table.

c.Full Outer Join: used for fetching matched and non-matched records from both the tables.
select * from table1 full outer join table2 on 
                              table1.commoncolumn = table2.commoncolumn;

- Self Join: is used to apply the join condition on the same table.
example: Display the employees who are earning same salaries.
select A.* from emp A, emp B where 
                                    A.sal = B.sal and A.empno <> B.empno;

- Distinct: is the function used to fetch unique values.

What is the differences between distinct and unique?

- unique is used for storing the unique values.

Correlated subqueries: Its a combination of subqueries and joins.

Pseudo Columns:
a.rowid - a unique address for each and every row in the database. rowid reference always starts with zero.It is static value.
b.rownum - It is a sequential number generated by the database as and when user fetches the data from database.rownumber reference always starts with one.It is dynamic value.









 


               












Roles and Responsibilities of QA Lead

A test lead is most commonly responsible for the following activities:
#1. He must be able to identify how his test teams aligns within an organization and how his team would achieve the roadmap identified for the project and hence organization.
#2. He has to identify the scope of the testing required for a particular release based on the requirements document.
#3. Put out the test plan after discussions with the test team and have it reviewed and approved by the management/ development team.
#4. Identifying the required metrics and work to have them in place. These metrics could be an inherent goal for the test team as well as what is being testing.
#5. Identifying the needed testing effort by calculating the sizing needed for the given release and plan the effort needed for the same.
#6. Figure out what skills are needed and balance the test resources accordingly with those needs based on their own interests as well. Also identify if there are skill gaps and plan training and education sessions for the identified test resources.
#7. Identify the tools for test reporting, test management, test automation, etc. and educate the team as required to be able to use those tools. Again, plan knowledge transfer sessions in case required for team members for the tools they would use.
#8. Retaining skilled resources by instilling leadership in them and provide guidance to junior resources as and where needed which would help them to grow.
#9. Create a fun and conducive environment for all resources to make sure they have maximum throughput.
Manage the test teams effectively by:
#1. Initiate the test planning activities for test case design and encourage the team to hold review meetings, ensure the review comments are incorporated.
#2. During the testing cycle monitor the test progress by constantly assessing the work assignment to each of the resources and re-balance or re-allocate them as required.
#3. Check if there might be any delays in achieving the schedule and hold discussions with testers to figure out the issues they may be facing and strive to resolve them.
#4. Hold meetings within the test team to make sure everyone is aware of what the fellow team members are doing.
#5. Present the timely status to the stakeholders and management and instill confidence about the work being done.
#6. Prepare any risk mitigation plans in case there are any delays are foreseen.
#7. Bridge any gaps and differences between the testing team and the management and form a clean two way interface channel.


SNMP

An SNMP-managed network consists of three key components:
  • Managed device
  • Agent — software which runs on managed devices
  • Network management station (NMS) — software which runs on the manager


SNMP itself does not define which information (which variables) a managed system should offer. Rather, SNMP uses an extensible design, where the available information is defined by management information bases (MIBs). MIBs describe the structure of the management data of a device subsystem; they use a hierarchical namespace containing object identifiers (OID). Each OID identifies a variable that can be read or set via SNMP. MIBs use the notation defined by Structure of Management Information Version 2.0

managed device is a network node that implements an SNMP interface that allows unidirectional (read-only) or bidirectional (read and write) access to node-specific information. Managed devices exchange node-specific information with the NMSs. Sometimes called network elements, the managed devices can be any type of device, including, but not limited to, routersaccess serversswitchescable modemsbridgeshubsIP telephonesIP video cameras, computer hosts, and printers.
An agent is a network-management software module that resides on a managed device. An agent has local knowledge of management information and translates that information to or from an SNMP-specific form.
Reference:  SNMP Wikipedia
Tweets by @sriramperumalla