Untitled
unknown
plain_text
8 months ago
3.8 kB
27
Indexable
Never
What is database: database is a storage system taht has a collection of data. Types of database: 2 types : 1RBBMS:-relational database store in form of tables, that can easily retrived, managed,and update. 2.Non-RDBMS:-non relational database store data in the form document,graph. What is Sql:- sql is relational databse. sql structured query language: sql is a language to communicate with database. sql command help you to store ,process ,analyze and manipulate database. What is difference between sql and Nosql sql: 1 sql is relational database 2.data store in tables 3.databases have fixed or static or predefine schema. 4.low performance with huge volumes of data. 5.ex:-mysql,db2 , oracle,sql-server. nosql: 1. it is non relational database. 2. data store in the key:value, document,graph. 3. they have dynamic schema. 4. Easily works with huge volumes of data 5. exa:mongodb Sql application: CURD:- create, update,read ,delete 4 types of sql commands: 1.Data Defination language:DDL create,alter,Drop,Truncate. 2. Data manipulation language:DML select , insert,Update,delete 3. Data control language: DCL grant, revoke 4. Trasaction control language:TCL commit, rollback Data Types: Datatypes of a column defines what value the column can store in table. Data type mailty classified into three categories: 1. numeric datatype:int ,float,bool, bigint,double. 2.string datatype: char, varchar 3.date &time: date,datetime,timestamp. ======================================================================================== Difference between char and varchar datatype: char: 1.char datypes is use for store chracter string of fixed length. 2.better performance than varchar varchar:1.varchar datype is used to store character string of variable length. 2. low performance than char comments in sql:- single line comments: -- this is sigle line comment multiline comments:- /* this is multiline comment */ ========================================================================================================= create database: syntax:- create database database_name; for checking database: command: show databases; for work database command- use dattabase_name exa: create database testdb; use testdb; show databases; ========================================================================================================== create table: syntax: create table table_name( column1 datatype, column2 datatype, - - column3 datatype ); exa; show tables; --table check create table Employee( empid int, name varchar(30), salary int, dept varchar(20), gender char(2) ); desc Employee; - table describe -- syntax:-create table tablename(colum1 datatype,column2 datatype,..........) create table employee(emp_id int ,emp_name varchar(22) ,salary int ,city varchar(20),dept varchar(20)); -- 1.insert into tablename(columns) values() -- 2. insert into tablename values() -- multiple insert value at one times -- 3. insert into tablename values( ...),(....),....alter insert into employee(emp_name,emp_id,city,dept) values("pranita",1,"pune","IT"); insert into employee values(2,"akash",20000,"nashik","HR"); insert into employee(emp_name,emp_id,city,dept) values("pranita",1,"pune","IT"),("suyash",3,"Pune","IT"),("pavan",4,"nanded","IT"); insert into employee values(2,"akash",20000,"nashik","HR"),(5,"pavan",30000,"nanded","IT"); insert into employee values(1,"suhash",NULL,"pune","HR") =============================================================================================
Leave a Comment