Tuesday, March 24, 2020

Teradata

Teradata is used for massive parllel processing(MPP). There are 4 different components of teradata i,e Node, Parsing engine, Message passing unit or Bynet, Access module processor(AMP).

Node :

Parsing engine : It receives queries from clients, checks for syntax errors, checks user privilages, prepares execution plan and pass it to Bynet, lastly receives results from AMP's and sends to client.

Bynet : Message passing layer is also called as Bynet. It allows communication between PE and AMP. It receives execution plan from PE and pass it to AMP, similarly it receives result from AMP and pass it to PE.

Amp : These are called as virtual processors, they actually stores and receives the data.


Teradata supports different types of tables :-
---------------------------------------------

Permanent table : This is a default table, it contains inserted data and stored data permanently.

Volatile table : The data inserted into a volatile table is retained only during the user session. Table and data is dropped at the end of the session. These tables are used to hold the data during data transmission.

Global temporary table : Table is delete at the end of user session.

Derived table :  Derived table holds the intermediate results in a query. Their lifetime is within the query in which they are created, used and dropped.


Set Versus Multiset :-
---------------------
Teradata classifies the tables as SET or MULTISET tables based on how the duplicate records are handled. A table defined as SET table doesn’t store the duplicate records, whereas the MULTISET table can store duplicate records.

Friday, March 6, 2020

Vi Editor

VI EDITOR :-
--------------
VI editor is case sensitive, used in two modes Command mode and Insert mode. By default it starts in command mode, to enter text you must enter into the insert mode. Press letter 'i' to enter into the insert mode. Press 'esc' key to come out of the insert mode, back to the command mode.


COMMANDS :-
---------------

vi Filename : Opens existing file and creates new file, if no file exists.

vi -R Filename : Opens existing file in the read only mode.

vi Filename : Opens existing file in the read only mode.

:w : This command is used to save content of the file.

:q : This command is used to come out of vi editor.

:wq :  This command is used to save and quit from the content of the file.

:q! : This command is used to come out of vi editor, if the file is modified without saving it.  

ctrl + zz : This command is used to save and quit from the content of the file.

:w filename : This command is used to save the specific file.


MOVE WITHIN THE FILE :-
-----------------------------

To move the within the file, you must be in command mode. So press Esc key twice followed by the below words.

k : Moves the cursor one line up.

j : Moves the cursor one line down.

h : Moves the cursor to the left one character position.

i : Moves the cursor to the right one character position.


EDITING THE FILES :-
------------------------

To edit file you need to be in insert mode. Many ways to enter the data into the files are mentioned below.

i : Used to enter into the insert mode and type data as per our requirement.

l : Used to enter text at the begining of the current line.

A : Used to enter text at the end of the current line.

o : Used to create new line below the cursor location.

O : Used to create new line above the cursor location.


DELETING THE CHARACTERS :-
----------------------------------

x : Used to delete the characters under the cursor location.

X : Used to delete the characters before the cursor location.

dw : Used to delete current cursor location to the next word.

d^ : Used to delete current cursor location to the begining of the line.

d$ : Used to delete current cursor location to the end of the line.

D : Used to delete current cursor position to the end of the current line.

dd : Used to delete the line the cursor is on.

SUBQUERIES PRACTISE QUESTIONS

1. Write a SQL query to find those employees who receive a higher salary than the employee with ID 7369. SELECT * FROM EMP WHERE SAL >  (...