Escolar Documentos
Profissional Documentos
Cultura Documentos
1. Int
2. Varchar(255)
3. Date :- YYYY-MM-DD
4. Time :- HH-MM-SS
Create table:
CREATE TABLE Table_name(column1 data type,column2 data type.....);
To Rename Column:
Alter table Table_name Rename column exiting_name to new_name;
To Modify Column:
Alter table Table_name modify column_name datatype;
Delete Operations:
delete from tablename;
Update Record:
Update Employer set depy='CSE' where Eid='101';
Two values combined together with have salary in between the two columns:
select col1 || 'has salary' || col2 from tablename;
Aggregate Operators:
1. Min :- select min(column_name) from table_name;
:- select count(*) from table_name : counts all including nos., null values
:- select count(column_name) from table_name : counts only non-null values of that particular
column
Comparison Operators:
1. = :- select * from emp where column_name=xyz;
3. >=
4. <
5. <=
8. Like :-
syntax for values except the values in brackets :- select * from table_name column_name not
in(value1,value2,value3);
Logical Operators :
1. Not
syntax :- select * from table_name where column_name=xyz and column_name2 like 'E%';
2.Concatenation
3.Comparision
4.IS,NULL,like,IN
5.between
6.and
7.or
8.not
Constraints:-
1.NOT NULL:- restrict user to enter null values.
3.Primary key:- combination of not null and unique. THERE IS ONLY ONE .
5.Foriegn key:-
#Multiple columns
create table person{
Ln varchar(10),
age int,
Relationship:-
Terminologies
1)Relation: Tables
2) Attributes: Columns
3) Tuple: Rows
5) Cardinality of relation
6) Data Value
7) Domain
Keys
1) Candidate key
2) Primary Key
3) Alternate key
4) Composite key
Integrity Rules
2) Referential IR
Normalization
Case Conversion
1.Lower
2.Upper
Character Manipulation
1.Concat
2.Substr
3.length
5.Lpad
6. Rpad
7.replace
Syntax : UPPER(str)
Output:KARUVACHI
-
Function 2: lower
Syntax : lower(str)
Output:karuvachi
Function 3: Initcap
Purpose : Returns the string with first letter in uppercase and rest of the letters in lowercase
Syntax : Initcap(str)
Output:Karuvachi
Function 4: Concat
Syntax : concat(str1,str2)
Output:KaruNand
Function 5: Lpad
Purpose : Pad in the left side of the string for given times length of the string
Syntax : Lpad(str1,n,str2)
Output:??Karu
-
Function 6: Rpad
Purpose : Pad in the right side of the string for given times length of the string
Syntax : Rpad(str1,n,str2)
Output:Karu??
Function 7: trim
Syntax : trim(str)
Output:karu
Function 8: Ltrim
Syntax : Ltrim(str)
Function 9: Rtrim
Syntax : Rtrim(str)
Syntax : length(str)
Output:9
Syntax : Instr(str1,str2)
Output:1
Syntax : substr(str,start_pos,number_of_chars)
Output:aruv
Syntax : SOUNDEX(str)
Example : SELECT SOUNDEX(karu) FROM DUAL;
Output:K600