0% found this document useful (0 votes)
42 views

DBMS Lab Steps - CMD Prompt

The document discusses the basics of using MySQL and MariaDB including how to create databases and tables, specify data types for table columns, add and modify columns to existing tables using ALTER commands, perform basic queries with SELECT and ORDER BY, set AUTO_INCREMENT values for primary keys, and configure the auto_increment_increment variable to control the increment amount for auto-increment values. Tables are used to store data in rows and columns with each row representing a record, and data types include common types like numbers, strings, dates, and more.

Uploaded by

aya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

DBMS Lab Steps - CMD Prompt

The document discusses the basics of using MySQL and MariaDB including how to create databases and tables, specify data types for table columns, add and modify columns to existing tables using ALTER commands, perform basic queries with SELECT and ORDER BY, set AUTO_INCREMENT values for primary keys, and configure the auto_increment_increment variable to control the increment amount for auto-increment values. Tables are used to store data in rows and columns with each row representing a record, and data types include common types like numbers, strings, dates, and more.

Uploaded by

aya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 50

WAMP

https://sourceforge.net/projects/wampserver/files/WampServer%203/Wampee%203.1/
MySQL is an open-source RDBMS, owned by Oracle
1) Show databases

2) Creating a New Database


3) Use Database

https://mariadb.com/kb/en/basic-sql-statements/
Table is a Database Object that holds, or contains, all of the data within that portion of the
database. It stores this data in named columns and numbered rows. Each row represents a
whole database record.
 When creating our Table, we need to Specify the type of data its rows and columns will
hold.

More Commonly Used Types of Data


 char(size) - fixed length string that can contain letters, numbers, special characters

 varchar(size) - variable length string that can contain letters, numbers, & special
characters

 boolean - Zero (or values that equate to 0) is false, non-zero is true ( 0- False / 1- True
)

 int(size optional) - a number up to 10 characters in length, accepts negative & positive


numbers

 bigint(size optional) - a number up to 19 characters in length, accepts negative &


positive numbers

 float(size, d) - a number with total number size represented by size and the number of
characters after
the decimal represented by the d

 date - date in the format of YYYY-MM-DD

 datetime - date time in the format of YYY-MM-DD hh:mm:ss

 time - time in the format of hh:mm:ss


ALTER TABLE `hello` ADD `rollno` VARCHAR(15) NOT NULL 
AFTER `regno`;
Order By (ASC, DESC)
( Auto Increment )

insert into accounts(CustomerName, DateOpened,CurrentBalance) values ('Ranjith','2019-02-01',23456.23),


('Govindraj','2009-08-15',99876.90);
---------------------------------------

CREATE TABLE Persons ( Personid int NOT NULL AUTO_INCREMENT=200, LastName varchar(255) , FirstName varchar(255), Age int,
PRIMARY KEY (Personid));

----------------------------------------------

CREATE TABLE Animals ( AnimalID NOT NULL AUTO_INCREMENT ,AnimalName CHAR(30) NOT NULL,Category char(10),Breed
varchar(20),Color varchar(20), PRIMARY KEY(AnimalID) );

----------------------------------------

Alter table Animals Auto_Increment=500;

----------------------------------------

INSERT INTO Animals (AnimalName, Category,Breed,Color) VALUES ('Gary','Dog','Labrador Retriever','Spotted'),


('Rosie','Cat','Oriental ShortHair','White'), ('Miranda','Penguin','Angel','Gray'), ('Susan','Fox','Deep Wood','Brown');
Create table testautoincrement
( ID NOT NULL Auto_Increment ,
Name varchar(25),
Dept varchar(25),
Primary Key(ID)
) Auto_Increment=250 ;
auto_increment_increment:
Mysql[Sales]> SET @@auto_increment_increment=2;

insert into testautoincrement(Student_name , Dept) values ('Pranav Anand','Mech');

You might also like