Saturday, 21 April 2018

WHERE Clause and Equal Operator

WHERE is used to search for a specific data.

Syntax :-

1. Specific data from all column
     Syntax:-
      SELECT * FROM table_name
      WHERE column_name operator 'value';

Ex :-
SELECT * FROM new_tab WHERE name='Anu';

SELECT * FROM new_tab WHERE stu_id = 7;



2. Specific data from specific column
   
    Syntax :-
      SELECT column_name FROM table_name WHERE column_name operator 'value';

Ex:-
   SELECT name FROM new_tab WHERE name = 'Anu';

  SELECT name FROM new_tab WHERE stu_id = 5;


Note :- Value can be text or numeric. if it is text then we have to  put single quotes.


 Example :-



Friday, 20 April 2018

Single quotes Problem

We will write a simple/normal syntax.
INSERT INTO my_tab (t_id, c_name, address) VALUES (142, 'K.K's Company', 'Delhi');

There are two way to solve this problem :-

Use backslash
Ex :-  'K.K\'s Company'

Use two time single quotes
Ex :- 'K.K"s Company

Example :-


Output :-


Select Statement

The SELECT statement is used to select data from database and retrieve the information.


1. Select all columns from the table
   
  Syntax :- SELECT * FROM table_name;
   
   Ex :- SELECT * FROM my_tab;

2. Select Particular columns the table
   
Syntax :- SELECT column_name1, column_name2,..............FROM table_name;
   
   Ex :- SELECT name, mobile FROM my_tab;


Example :-


Thursday, 19 April 2018

Insert into

The INSERT INTO statement is used to insert new records/row/tuple in a table.

Syntax :-
INSERT INTO table_name (column1, column2, column3, column4,.....)
VALUES (value1, 'value2', 'value3', value4.....);

Ex :-
INSERT INTO my_tab (stu_id, name, address, mobile_no)
VALUES (05, 'Anu', 'Delhi', 982112);

Rules :-
Column and Value order should be same.
Any value that goes into a VARCHAR, CHAR, DATE, or TEXT column has single quotes around it. There are no need of quotes for numeric values (INT, DEC).



Example :-




Without specifying column name

Syntax :-
INSERT INTO table_name
VALUES(value1, 'value2', 'value3', value4);

Ex :-
INSERT INTO my_tab
VALUES (05, 'Anu', 'Delhi', 982112);



Rules :-
The values order should be same as column
We need to insert record for each column we can not leave any column.



Changing the order of column

Syntax :-
INSERT INTO table_name (column2, column1, column4, column3)
VALUES ('value2', value1, value4, 'value3');

Ex :-
INSERT INTO my_tab(name, stu_id, mobile_no, address)
VALUES ('Anu', 05, 982112, 'Delhi');





Insert Data only in Specified Columns

Syntax :-
INSERT INTO table_name (column1, column2, column3)
VALUES (value1, 'value2', 'value3')

Ex :-
INSERT INTO my_tab(stu_id, name, address)
VALUES (05, 'Anu', 'Delhi');







Insert multiple records at one time

Syntax :-
INSERT INTO table_name (column1, column2, column3, column4)
VALUES (value1, 'value2', 'value3', value4);
(value1, 'value2', 'value3', value4);

Ex :-
INSERT INTO my_tab (stu_id, name, address, mobile_no)
VALUES (01, 'Anu', 'Delhi', 982112),
(02, 'Rohan', 'Mumbai', 561425);





Wednesday, 18 April 2018

Data Types

INT or INTEGER - It holds whole number between -32,768 and 32,767 either it is negative or positive. It can not hold a decimal numbers. The maximum number of digits may be specified in parenthesis.

Syntax :-
 column_name INT (size);

Ex :-
 roll INT (5);


DEC or DECIMAL (size, p) - It holds fixed point numbers, size is the total number of digits and p is the number of digits after the decimal point. The decimal point and the negative sign '-' are not counted in size. If p is 0, values have no decimal point. The maximum number of size for decimal is 65 and for p 30. if p omitted the default is 0. if size is omitted, the default is 10.

Syntax :-
 column_name DECIMAL(size, p);

Ex :- 
 price DECIMAL (4,2);

CHAR or CHARACTER - It holds a fixed length string  (can contain letter, numbers, and special characters). The fixed size is specified in parenthesis. It can store up to 255haracters.

Syntax :- 
 column_name CHAR (20);

Ex :-
  name CHAR (20);

VARCHAR - It holds a variable length string (can contains letters, numbers, and special character). The maximum size is specified parenthesis. It can store up to 255 characters.
Note : If we put a greater value than 255 it will be converted to a TEXT type.

Syntax :- 
 column_name VARCHAR (size);

Ex :- 
 name VARCHAR (50);

TEXT - It holds a string with a maximum length of 65,535 characters.

Syntax :-
 column_name TEXT;

Ex :- 
 address TEXT;

DATE - It display Date values in yyyy-mm-dd format.

Syntax :-
 column_name DATE;

Ex :-
age DATE;

DATATIME - It display DATETIME values in yyyy-mm-dd  hh:mm:ss format.

Syntax :- 
 column_name DATETIME;

Ex :- 
 Date_of_join DATETIME;

TIMESTAMP - It also displayes date and time.

Syntax :-
 column_name TIMESTAMP;

Ex :- 
 login_dt TIMESTAMP;






Tuesday, 17 April 2018

Create Table

Syntax :-

CREATE TABLE table name
(
Column_name1 data-type (size),
Column_name2 data-type (size),
Column_name3 data-type (size)
);

Ex :-
CREATE TABLE my_tab
(
name varchar (30),
roll int (4),
address varchar (100)
);


Another way to create a table

Syntax :-
CREATE TABLE table name
(
Column_name1 data-type (size) [constraints],
Column_name2 data-type (size) [constraints],
Column_name3 data-type (size) [constraints]
);

Ex :-
CREATE TABLE my_tab
(
name varchar (30) NOT NULL,
roll int (4) PRIMARY KEY,
address varchar (100)
);

Guidelines for creation of Table

 1. Table name should start with an alphabet.
 2. In table name, blank spaces and single quotes are not allowed.
 3. Reserve words of that RDBMS/DBMS cannot be used as table name.
 4. Proper data type and size should be specified.
 5. Unique column name should be specified.

 

Sunday, 15 April 2018

Create Database

It is used to create database.

Syntax:- CREATE DATABASE database_name;
Ex:- CREATE DATABASE my_db;

Guide for creation of database:-
 Name should start with an alphabet
Blank space and single quotes are not allowed
Reserve words of that RDBMS/DBMS can not be used as database name




Use a database

 This is used to tell your RDBMS/DBMS that you want to use this database.

Syntax:- USE database_name;
Ex:- USE my_db;



Student Registration Form

Program:-

<html>
<head>
<script type=”text/javascript” src=”validate.js”></script>
</head>
<body>
<form action=”#” name=”StudentRegistration” onsubmit=”return(validate());”>
<table cellpadding=”2″ width=”20%” bgcolor=”99FFFF” align=”center”
cellspacing=”2″>
<tr>
<td colspan=2>
<center><font size=4><b>Student Registration Form</b></font></center>
</td>
</tr>
<tr>
<td>Name</td>
<td><input type=text name=textnames id=”textname” size=”30″></td>
</tr>
<tr>
<td>Father Name</td>
<td><input type=”text” name=”fathername” id=”fathername”
size=”30″></td>
</tr>
<tr>
<td>Postal Address</td>
<td><input type=”text” name=”paddress” id=”paddress” size=”30″></td>
</tr>
<tr>
<td>Personal Address</td>
<td><input type=”text” name=”personaladdress”
id=”personaladdress” size=”30″></td>
</tr>
<tr>
<td>Sex</td>
<td><input type=”radio” name=”sex” value=”male” size=”10″>Male
<input type=”radio” name=”sex” value=”Female” size=”10″>Female</td>
</tr>
<tr>
<td>City</td>
<td><select name=”City”>
<option value=”-1″ selected>select..</option>
<option value=”New Delhi”>NEW DELHI</option>
<option value=”Mumbai”>MUMBAI</option>
<option value=”Goa”>GOA</option>
<option value=”Patna”>PATNA</option>
</select></td>
</tr>
<tr>
<td>Course</td>
<td><select name=”Course”>
<option value=”-1″ selected>select..</option>
<option value=”B.Tech”>B.TECH</option>
<option value=”MCA”>MCA</option>
<option value=”MBA”>MBA</option>
<option value=”BCA”>BCA</option>
</select></td>
</tr>
<tr>
<td>District</td>
<td><select name=”District”>
<option value=”-1″ selected>select..</option>
<option value=”Nalanda”>NALANDA</option>
<option value=”UP”>UP</option>
<option value=”Goa”>GOA</option>
<option value=”Patna”>PATNA</option>
</select></td>
</tr>
<tr>
<td>State</td>
<td><select Name=”State”>
<option value=”-1″ selected>select..</option>
<option value=”New Delhi”>NEW DELHI</option>
<option value=”Mumbai”>MUMBAI</option>
<option value=”Goa”>GOA</option>
<option value=”Bihar”>BIHAR</option>
</select></td>
</tr>
<tr>
<td>PinCode</td>
<td><input type=”text” name=”pincode” id=”pincode” size=”30″></td>
</tr>
<tr>
<td>EmailId</td>
<td><input type=”text” name=”emailid” id=”emailid” size=”30″></td>
</tr>
<tr>
<td>DOB</td>
<td><input type=”text” name=”dob” id=”dob” size=”30″></td>
</tr>
<tr>
<td>MobileNo</td>
<td><input type=”text” name=”mobileno” id=”mobileno” size=”30″></td>
</tr>
<tr>
<td><input type=”reset”></td>
<td colspan=”2″><input type=”submit” value=”Submit Form” /></td>
</tr>
</table>
</form>
</body>
</html>

Entry Level Form


Program:-
<html>
<head>
<title>Entry Level Form</title>
</head>
<body>
<form>
<ul class=”form-style-1″>
<li><label>Full Name <span class=”required”>*</span></label><input type=”text” name=”field1″ class=”field-divided” placeholder=”First” />&nbsp;
<input type=”text” name=”field2″ class=”field-divided” placeholder=”Last” /></li>
<br>
<li>
<label>Email <span class=”required”>*</span></label>
<input type=”email” name=”field3″ class=”field-long” />
</br>
</li>
<br>
<li>
<label>Subject</label>
<select name=”field4″ class=”field-select”>
<option value=”Select”>select</option>
<option value=”MatLab”>MatLab</option>
<option value=”Java”>Java</option>
<option value=”HTML”>HTML</option>
<option value=”CSS”>CSS</option>
<option value=”C and C++”>C and C++</option>
<option value=”General Question”>General</option>
</select>
</br>
</li>
<br>
<li>
<label>Your Message <span class=”required”>*</span></label>
<textarea name=”field5″ id=”field5″ class=”field-long field-textarea”></textarea>
</br>
</li>
<br>
<li>
<input type=”submit” value=”Submit” />
</br>
</li>
</ul>
</form>
</body>
</html>

Personal Details Form


Program:-

<html>
<head>
<title>Personal Details Form</title>
</head>
<body>
<div class=”form-style-3″>
<form>
<fieldset><legend>Personal Details</legend>
<label for=”field1″><span> Full Name <span class=”required”>*</span></span>
<input type=”text” class=”input-field” name=”field1″ value=”” /></label>
<label for=”field2″><span>Email <span class=”required”>*</span></span>
<input type=”email” class=”input-field” name=”field2″ value=”” /></label>
<label for=”field3″><span>Phone <span class=”required”>*</span></span>
<input type=”text” class=”input-field” name=”field3″ value=”” /></label>
<label for=”field4″><span>Subject</span><select name=”field4″ class=”select-field”>
<option value=”Select”>Select</option>
<option value=”MatLab”>MatLab</option>
<option value=”JAVA”>Java</option>
<option value=”HTML and CSS”>HTML and CSS</option>
<option value=”C and C++”>C and C++</option>
<option value=”Any Question”>Any Question</option>
</select></label>
</fieldset>
<fieldset><legend>Message</legend>
<label for=”field6″><span>Message <span class=”required”>*</span></span><textarea name=”field6″ class=”textarea-field”></textarea></label>
<label><span>&nbsp;</span><input type=”submit” value=”Submit” /></label>
</fieldset>
</form>
</div>
</body>
</html>

Information Form


Program:-

<html>
<head>
<title>Information Form</title>
</head>
<body>
<form class=“form-style-9”>
<ul>
<li>
<input type=“text” name=“field1” class=“field-style field-split align-left” placeholder=“Name” />
<input type=“email” name=“field2” class=“field-style field-split align-right” placeholder=“Email” />
</li>
<li>
<input type=“text” name=“field3” class=“field-style field-split align-left” placeholder=“Phone” />
<input type=“url” name=“field4” class=“field-style field-split align-right” placeholder=“Website” />
</li>
<li>
<input type=“text” name=“field3” class=“field-style field-full align-none” placeholder=“Subject” />
</li>
<li>
<textarea name=“field5” class=“field-style” placeholder=“Message”></textarea>
</li>
<li>
<input type=“submit” value=“Send Message” />
</li>
</ul>
</form>
</body>
</html>

Website Design in HTML and CSS


<html>
<head>
<title>Castor Classes</title>
<style type=”text/css”>
body{
background-color:gray;
font-family:Arial,Helvetica,sans-serif;
}
*
{
margin:0;
padding:0;
}
#wrapper{
border:1px solid;
width:970px;
padding:2px;
background-color:gray;
}
#header{
border:1px solid;
width:100%;
background-color:white;
}
#header ul{
list-style-type:none;
}
#header ul li{
border:1px solid;
float:left;
color:sky;
background-color:green;
width:190px;
text-align:center;;
height:30px;
line-height:30px;
}
#header ul li a{
text-decoration:none;
}
#header ul li:hover{
background-color:blue;
}
#image{
width:100px;
}
#bodypart{
border:1px solid;
margin-top:10px;
}
#bodyleft{
border:1px solid;
float:left;
width:250px;
}
#bodyleft h2{
background-color:pink;
color:sky;
padding:4px;
}
#bodyleft ul{
list-style-type:none;
}
#bodyleft ul li{
border:1px solid;
padding:5px;
height:30px;
line-height:20px;
}
#bodyleft ul li a{
color:black;
text-decoration:none;
}
#bodyleft ul li:hover{
color:blue;
background-color:yellow;
}
#bodyright{
border:1px solid;
width:1070px;
float:left;
margin-left:2px;
padding-right:10px;
}
#bodyright h2{
background-color:black;
color:red;
padding:2px;
}
#bodyright p{
padding:6px;
padding-right:10px;
font:20px;
text-align:justify;
}
#footer{
border:1px solid;
background-color:pink;
color:blue;
text-decoration:none;
padding:1px;
margin-top:1px;
}
#footerright{
border:0px solid;
width:150px;
margin-left:10px;
float:right;
margin-bottom:3px;
padding:1px;
text-decoration:none;
}

</style>
</head>
<body>
<div id=”wrapper”>
<div id=”header”>
<ul>
<li><a href=”#”> Home</a></li>
<li><a href=”#”>About Us</a></li>
<li><a href=”#”>Courses</a></li>
<li><a href=”#”>Contact</a></li>
<li><a href=”#”>Online Video</a></li>
</ul>
<div id=”image”></div>
<img src=”html/image/online.jpg”/></div>
</div>
<div id=”bodypart”>
<div id=”bodyleft”>
<h2>Courses</h2>
<ul>
<li><a href=”http://castorclasses.com/courses/matlab-program-2/”>MatLab </a></li>
<li><a href=”http://castorclasses.com/courses/c-language/”>C Language</a></li>
<li><a href=”http://castorclasses.com/php-programs/”>PhP </a></li>
<li><a href=”http://castorclasses.com/courses/java/”>Java </a></li>
<li><a href=”http://castorclasses.com/html-and-css/”>HTML and CSS </a></li>
<li><a href=”#”> C++</a></li>
</ul>
</div>
<div id=”bodyright”>
<h2>Welcome to our online Courses (Castor Classes)</h2>
<p>This is provide a online classes for all subject.Online courses are revolutionizing formal education,
and have opened a new genre of outreach on cultural and scientific topics. These courses deliver a series of lessons to a web browser or mobile device,
to be conveniently accessed anytime, anyplace.</p>
<p>An online course is designed as a built environment for learning.Deciding to study online can bring up a whole range of emotions –
excitement, pride and maybe a little apprehension –
but don’t worry. With Open Colleges,
you’ll have all the flexibility and support you need to get through your course and create a new future.
Find out more about the benefits of studying online with us below,
discover more about how online learning works, or simply go ahead and get started.</p>
<p>This is provide a online classes for all subject.Online courses are revolutionizing formal education, but don’t worry. With Open Colleges,
you’ll have all the flexibility and support you need to get through your course and create a new future.
Find out more about the benefits of studying online with us below,
and have opened a new genre of outreach on cultural and scientific topics. These courses deliver a series of lessons to a web browser or mobile device,
to be conveniently accessed anytime, anyplace.</p>
</div>
<br clear=”all”/>
</div>
<div id=”footer”>
<h3>About Us</h3>
<li><a href=”http://castorclasses.com/contact-us/about-us/introduction/”>Introduction</li>
<li><a href=”http://castorclasses.com/contact-us/about-us/mission-and-vision/”>Mission and Vision</li>
<li><a href=”http://castorclasses.com/contact-us/about-us/management/”>Managements</li>
<div id=”footerright”>
<h4>Thank You</h4>
<li>Castor Classes</li>
</div>
<br clear=”all”/>
</div>
</div>
</body>
</html>

How to set style of list in CSS?


—>This is use for give some decoration of list.

Syntax:-

ul{
list-style-type:circle OR squre OR upper roman OR upper alpha;
list-style-image:url(‘folder name’);
}
ul li{
line-height:30px;
}
ul li:hover{
margin-left:10px;
}
ul li a{
text-decoration:none;
}

Example:-

<!Doctype html>
<html>
<head>
<title>CastorClasses.com</title>
<style type=”text/CSS”>
ul{
list-style-type:circle OR squre OR upper roman OR upper alpha;
list-style-image:url(‘folder name’);
}
ul li{
line-height:30px;
}
ul li:hover{
margin-left:10px;
}
ul li a{
text-decoration:none;
}
</head>
<body>
<ul>
<li>
<a href=”#”>HOME</a></li>
<a href=”#”>ABOUT US</a></li>
<a href=”#”>SERVICES</a></li>
<a href=”#”>CONTACT US</a></li>
</UL>
</body>
</html>

Popular Posts

Categories

100 Python Programs for Beginner (53) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (932) Python Coding Challenge (363) Python Quiz (24) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses