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
Why do we write bin bash in shell scripts?
What is the best scripting language?
Why are there shells on the beach?
How do we delete all blank lines in a file?
Calculate a real number calculation directly from the terminal and not any shell script.
What is bash eval?
What makes c shell a more preferable option than the bourne shell?
How do I run a shell script in powershell?
I have 2 files and I want to print the records which are common to both.
What is shell prompt?
What does $@ mean in shell?
What is a beat in a script?
Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.
What is ms powershell?
What is subshell?