Skip to main content

Posts

Showing posts from 2022

BANK PROJECT - MYSQL

Create the following tables and  solve the queries.   CREATE TABLE customer   (        custid VARCHAR(6),        fname VARCHAR(30),        mname VARCHAR(30),        ltname VARCHAR(30),        city VARCHAR(15),        mobileno VARCHAR(10),        occupation VARCHAR(10),        dob DATE,       CONSTRAINT customer_custid_pk PRIMARY KEY(custid)       );     CREATE TABLE branch    (     bid VARCHAR(6),     bname VARCHAR(30),     bcity VARCHAR(30),     CONSTRAINT branch_bid_pk PRIMARY KEY(bid)     ); CREATE TABLE account    (       acnumber VARCHAR(6),       custid  VARCHAR(6),       bid VARCHAR(6),       opening_balance INT(7),       aod DATE,       atype VARCHAR(10),       astatus VARCHAR(10),       CONSTRAINT account_acnumber_pk PRIMARY KEY(acnumber),       CONSTRAINT account_custid_fk FOREIGN KEY(custid) REFERENCES customer(custid),       CONSTRAINT account_bid_fk FOREIGN KEY(bid) REFERENCES branch(bid)      ); CREATE TABLE trandetails     (         tnumber VARCHAR(6),      acnumber VARC

bulk bind

 bulk collection when you delete a set of records that you wish to using a pl/sql program ,  oracle takes one empno number from pl/sql engine at a time to sql engine and executes it and comes back for the next one. If you have 100 such empno-records then oracle makes 100 such trips to pl/sql and sql engines. this trip between sql engine and pl/sql engine is called CONTEXT SWITCH. To ensure that only one context switch is made and not 100 or more we do the following: bulk bind the entire collection by using "FORALL syntax" to complete the job at one go. when oracle reads FORALL it understands that the entire collection of values are to be passed to the pl/sql engine for execution and not 100 context switches. Although the FORALL statement contains an  iteration scheme, it is not a FOR loop. wap to read all the records from emp table and load them to a new table emp_dup_tab, using bulk bind concept . create table emp_dup_table as select * from emp where 1=2; declare type dept_t

head command in unix

    Head Command Examples The head command in unix or linux system is used to print the first N lines from the file to the terminal. The syntax of head command is  head [options] [files] The  head command options  are:  ·                        c : Prints the first N bytes of file; With leading -, prints all but the last N bytes of the file. ·                        n : Prints first N lines; With leading - print all but the last N lines of each file. Head Command Examples :  Create the following file in your linux or unix operating system for practicing the examples:  > cat example.txt linux storage ubuntu os fedora 1. Display first 10 lines  By default, the head command prints the first 10 lines from a file.  > head example.txt 2. Display first N lines  Use the -n option to  print the first n lines from a file . The following example prints the first 2 lines from the file:  > head -n2 example.txt linux storage u

find command in unix

  Find Command in Unix and Linux Examples Find is one of the powerful utility of Unix (or Linux) used for searching the files in a directory hierarchy. The syntax of find command is find [pathnames] [conditions] Let see some practical exercises on using find command. 1.  How to run the last executed find command? !find This will execute the last find command. It also displays the last find command executed along with the result on the terminal. 2.  How to find for a file using name? find -name "sum.java" ./bkp/sum.java ./sum.java This will find all the files with name "sum.java" in the current directory and sub-directories. 3.  How to find for files using name and ignoring case? find -iname "sum.java" ./SUM.java ./bkp/sum.java ./sum.java This will find all the files with name "sum.java" while ignoring the case in the current directory and sub-directories. 4.  How to find for a fi