-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
select 5-6 as substarction, 5+5 as addition ,5*6 as multiplication , 20/2 as division; | ||
|
||
select 5>6 as greaterthan; | ||
select 5<6 as lessthan; | ||
|
||
select 9 >= 10 as lessthanequalto; | ||
|
||
select 25=25 as comparetwovalues; | ||
|
||
select 5=6 && 1=2 as result; | ||
|
||
select 5=5 AND 1=1 as result , 5=5 OR 1=2 as result; | ||
|
||
select !0 as result , !1 ; | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
create database CUSTOMER; | ||
create table customer_details( | ||
CUSTOMER_IDcustomer_detailscustomer_detailscustomer_details int , | ||
CUSTOMER_Name varchar(15), | ||
CUSTOMER_Number bigint, | ||
CUSTOMER_Address varchar(200) | ||
|
||
); | ||
select * from customer_details; | ||
|
||
desc customer_details; | ||
|
||
create table customer_order( | ||
customer_order_ID int, | ||
customer_order_Name varchar(15), | ||
customer_order_Price double | ||
|
||
); | ||
|
||
select * from customer_order; | ||
|
||
desc customer_order; | ||
show columns from customer_order; | ||
|
||
create table customer_transaction( | ||
transaction_Id int , | ||
transaction_Time time unique, | ||
transaction_Amount double check (transaction_Amount>1), | ||
transaction_Type varchar(10) not null, | ||
transaction_status boolean, | ||
primary key (transaction_Id) | ||
); | ||
desc customer_transaction; | ||
|
||
alter table customer_transaction modify transaction_status boolean default false; | ||
desc customer_transaction; | ||
alter table customer_transaction modify transaction_status varchAR(20) default false; | ||
desc customer_transaction; | ||
alter table customer_transaction add transaction_Addreses varchAR(20) not null; | ||
alter table customer_transaction drop transaction_Addreses; | ||
desc customer_transaction; | ||
show tables; | ||
|
||
create table product( | ||
product_id int, | ||
product_Name varchar(15), | ||
product_price double, | ||
primary key (product_id) | ||
); | ||
show tables; | ||
select * from product; | ||
drop table product; | ||
create database student; | ||
|
||
drop database student; | ||
|
||
alter table product rename to product_Details; | ||
alter table product_details rename column product_price to productPRice; | ||
desc product_details; | ||
alter table product_details rename column product_price to product_Price; | ||
insert into product_details (product_id,product_Name,productPRice) values (1,'tv',15000.0); | ||
insert into product_details (product_id,product_Name,productPRice) values (2,"watch",4500.0); | ||
insert into product_details (product_id,product_Name,productPRice) values (3,'MObile',10000.0); | ||
-- insert into product_details values (4,'Bike',450000.0),(5,'Sanitizer',50); | ||
insert into product_details (product_id,productPRice) values (5,15000.0); | ||
select * from product_details; | ||
|
||
-- delete the table records ------------------------------ | ||
truncate product_details; | ||
select * from product_details; | ||
-- -------------------------------------------------------- | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
SQL : | ||
Data --> | ||
DataBase --> | ||
RDBMS ---> | ||
DT---------------------------- | ||
integer- BigINT,smallInt,int , tiny int -->127 to -128 | ||
String - Character -->size[255] | ||
integer+String-> Address-->VarChar size[255] | ||
integer+String-> text -->n number of lines | ||
folating-------> float,double,decimal | ||
boolean--------> true , false | ||
|
||
Date -----------> date,datetime,time,timestamp | ||
--------------------------------- | ||
Opeartions | ||
Airthmatic | ||
comparative /relatives ope | ||
logical--And -(both) OR--(one) NOT () | ||
AND -----both side will be true--0 | ||
OR ------One side will be true --1 | ||
|
||
SCHEMAS ---it is collection of DATABASE | ||
Database -- | ||
logical structure ---tables ,database | ||
phyical structure ---size , memory | ||
|
||
|
||
keywords | ||
|
||
fasle---0 | ||
true---1 | ||
|
||
declarative ---how to do not saying what to do | ||
|
||
Types of commands | ||
create ---database ,tables | ||
database | ||
syntax : - create database databaseName; | ||
tables | ||
create table tablename( | ||
//query | ||
|
||
); | ||
|
||
|
||
example: create database customer; | ||
|
||
create table customer_Details( | ||
customer_ID int ,//int size defaultt 11 | ||
customer_name varchar(15)//name should be less than 15 character | ||
customer_number bigint, | ||
customer_Address varchar(200) | ||
); | ||
select * from customer_details;//tables view | ||
desc customer_details;//table description | ||
show columns from customer_order;//columns | ||
constraint //not null | ||
keywords/rule to write | ||
unique----id should be | ||
|
||
check ----restrict the timings | ||
condition, check age >18 | ||
|
||
primary key-- combination of is not null and unique | ||
|
||
foreign key --parent to child (any properties u can make it as primary key) | ||
|
||
alter--->it is change the structure of the table | ||
|
||
modify--- | ||
alter table customer_transaction modify transaction_status boolean default false; | ||
|
||
add---- | ||
alter table customer_transaction add transaction_Addresee varchAR(20) not null; | ||
|
||
drop----- | ||
alter table customer_transaction drop transaction_Addreses; | ||
desc--- | ||
desc customer_transaction; | ||
|
||
11/04/2021 | ||
Administartive commonds | ||
show databases it wil show the all database name | ||
show tables | ||
DDL -- data defination language -----create ,alter,drop, | ||
DML -- data manipulation language ---insert, | ||
|
||
reaname table | ||
alter table product rename to product_Details; | ||
rename column name | ||
alter table product_details rename column product_price to productPRice; | ||
truncate | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|