how do you write sql queries using shell script
for eg:- we have databae table like EMPNO,ENAME,SAL,DEPTNO
columns in EMP table how you display EMPNO,SAL FIELDS from emp
in SHELL SCRIPT please explain with an example

Answer Posted / vikas

U can use .
Database coumns are : Emp.No, Emp. Name, Salary, Dept.No.
$ cut -f 1,3 <filename> > temp.txt

This will print two columns: emp/ No and salarya and store
it in fiile temp.txt in same directory.

If u want to sort them:
$ cut -f 1,3 <filename> > temp.txt
$ sort -otemp.txt temp.txt

Is This Answer Correct ?    5 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is console line?

572


Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.

703


Why is shell scripting important?

576


What does $0 mean in shell script?

560


shell script for reverse the string

919






what is tickets $ what low,medium,high priorite pls define time also

1723


What is awk in shell script?

754


What is a boot block?

583


What makes c shell a more preferable option than the bourne shell?

543


What is bash eval?

549


What is an sh file?

559


What is sh in shell script?

576


What's the difference between scripting and coding?

599


What is the use of "$#" in shell scripting?

550


Explain about non-login shell files?

696