Basics of My SQL:

SQL is mainly used for storing and retrieving data from databases, but it can do much more than that. Anything you need to do with a database, you can do with SQL. It’s flexible, powerful, and quick while being accessible and affordable for most businesses.

Basic steps:

Open My SQL Workbench.

Create Database:

A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS).

  • First create new Database eg:(learning).
  • next step use database learning

Create table:

Create table inside the (Learning)database

  • Table name (movies)
  • using Data type (varchar(20))
create table movies(movie_name varchar(20),actor varchar(20),release_year int,director varchar(20),production varchar(20));
movie_nameactorrelease_yearDirectorproduction

Insert value inside the table:

insert into movies value("jilla","vijay",1998,"sk","sunpictures");
insert into movies value("Kathi","vijay",2000,"sk",sunpictures");
insert into movies value("theri","vijay",2001,"sk","sunpictures");
insert into movies value("villu","vijay",2002,"sk","sunpictures");

movie_nameactorrelease_yeardirectorproduction
jillavijay1998sksunpictures
kathivijay2000sksunpictures
therivijay2001sksunpictures
villuvijay2002sksunpictures

If you Want to delete particular database:

delete from movies where movie_name=""kathi";
movie_nameactorrelease_yeardirectorproduction
jillavijay1998sksunpictures
therivijay2001sksunpictures
villuvijay2002sksunpictures

If you Want to update the table:

update movies set movie_name="beast" where release_year=1998;
movie_nameactorrelease_yeardirectorproduction
beastvijay1998sksunpictures
therivijay2001sksunpictures
villuvijay2002sksunpictures

If you Want to insert the another values in table:

insert into movies value("billa","ajith",2020,"null","sunpictures);
movie_nameactorrelease_yeardirection production
beastvijay1998sksunpictures
therivijay2001sksunpictures
villuvijay2002sksunpictures
billaajith2020sunpictures

If youWant count the table how many Rows:

select count(*) from movies;

4 rows in a table

If you want to select particular name from table:

select * from movies where movie_name<="theri";
movie_nameactorrelease_yeardirectionproduction
therivijay2001sksunpictures

My output:

Scanner in java:

Java User Input:

The Scanner class is used to get user input, and it is found in the java.util package.

Why we use Scanner:

Scanner is a class in java. util package used for obtaining the input of the primitive types like int, double, etc. and strings. It is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming.

What is (System.in)Scanner class:

Scanner class allows user to take input from console. System.in is passed as a parameter in Scanner class. It tells the java compiler that system input will be provided through console(keyboard).

What is the benefits of scanner class:

The advantages of Scanner Class are: The end of data element can be determined through a special token. It not only reads data but also parses it into specific types like short, int, float, boolean, etc. It can read String as well as primitive data types.

Example program:

package scanner;


import java.util.Scanner;

public class Smart
{

public static void main(String[] args)
{
	Scanner sc = new Scanner(System.in);
	System.out.println("enter number");
	int no = sc.nextInt();
	System.out.println(no+10);
}
}

output:

Array in java:

Normally, an array is a collection of similar type of elements which has contiguous memory location.

Java array is an object which contains elements of a similar data type. Additionally, The elements of an array are stored in a contiguous memory location. It is a data structure where we store similar elements. We can store only a fixed set of elements in a Java array.

Java array

Advantages:

  • Code Optimization: It makes the code optimized, we can retrieve or sort the data efficiently.
  • Random access: We can get any data located at an index position.

Disadvantages:

  • Size Limit: We can store only the fixed size of elements in the array. It doesn’t grow its size at runtime. To solve this problem, collection framework is used in Java which grows automatically.

Example:

public class Array {

	public static void main(String[] args) 
	{
		int[] array= {10,20,30,40,50};
		System.out.println(array[4]);
	}

}

Array in loop:

public class Array 
{
public static void main(String[] args)
{
	int[] a= {90,78,56,79,92};
	int total=0;
	for(int i=0; i<a.length;i++)
	{
		total=total+a[i];
	}
	System.out.println(total);	
	}
}

output:

Why do we use length in array:

Note that length determines the maximum number of elements that the array can contain or the capacity of the array. It does not count the elements that are inserted into the array. That is, length returns the total size of the array.

public class
{
public static void main(String[] args)
{
  int[] a={90,78,56,79,92};
 System.out.println(a.length);

}
}

Html/day1

Basic codes:

Why we use <h1> increase font size,

<h1> is big size,

<h2> is smaller then <h1> ,

<h3> is smaller then <h2> ,

<h4> is smaller then <h3>,

<h5> is smaller then <h4>.

Type paragraph in web page:

use this code <p> iam mathesh good boy</p>

we want to create a text box use this :

  • Enter name:<input type=”text” ><br><br>
  • Enter last name:<input type=”text”><br><br>
  • Enter password:<input type=”text disable” ><br><br>

why use <br>:

Text boxes line by line(order wise) using key <br>

If we want add image in web page:

use this code <img src=”/home/Mathesh/Pictures/index.jpeg”>

<h1><p>I am Mathesh</p></h1>
Enter name:<input type="text" ><br><br>
Enter last name:<input type="text"><br><br>
Enter password:<input type="text disable" ><br><br>
<img src="/home/Mathesh/Pictures/index.jpeg">

Output:

Mock interview 2:

What is class:

  • class is a Blueprint (or) template of an object
  • class is a template is used to create an objects
  • class name first must be a capsletter
  • It is a logical entity
  • it can’t be physical

Syntax in class:

class <class name>
{
//
//
//
}

A class in java contains:

  1. fields
  2. methods
  3. block
  4. nested class and interface

What is object:

  • object is memory reference of a class
  • object is real time entity
  • object is instantiated from class
  • An entity that has state and behaviour is known as object
  • It can be physical (or) logical entity

Syntax in object:

class Private       //class
{

Private pr = new Private();     //object

}

Object has three characters:

  1. State–>state represents the data(value)
  2. Behavior–>it represents the behavior(functionality)
  3. Identity—>An object identity is typically implemented via a unique ID

What is Abstraction:

  • A class which is declared with the abstract keyword is known as abstract class.
  • Is a data hiding
  • Showing only necessary data hiding unwanted data. Showing only functionality to the user.
  • Abstract class can have main method.
  • Static and non static can have an abstract class.
  • we cannot create object in abstract class.
  • Abstract class can have an a constructor but don’t have an object.
  • if we want to access method from one to another using abstract key.
  • An abstract class must be declared with an abstract keyword.
  • In case inside the class one abstract method must change the class name in abstract class.

Syntax in abstraction:

Once we want to access (one to another) the abstract class(or) abstract method use the keyword (Extends)

public abstract class SmartPhone
{
int call;
public void smartphone()
{
System.out.println("smartphone ubder development");
}
public abstract int call(int seconds);
	
public abstract void sendmessage();



public abstract void receivecall();



public void browser()
{
System.out.println("SmartPhone");
}
}

public class Samsung extends SmartPhone 
{
static int price = 5000;

public static void main(String[] args)
{
Samsung sam = new Samsung();
sam.browser();
sam.sendmessage();
	sam.receivecall();
	//sam.providepattern();
}
public void sendmessage()
{
	System.out.println("messages");
}
public void receivecall()
{
	System.out.println("call");
}
}
	

Encapsulation:

  • It is data protecting and data Hiding(security).
  • this idea of bundling data and methods that work on data within one unit.
  • the major advantage of encapsulation in java is data hiding.
  • we can allow the programmer to decide on the access of data and methods.

Advantages:

(Flexible programs)–(Easy debugging and testing)–(Reusability)–(Hiding data)

Keywords in encapsulation:

Default–> default key access with in the package.

protected–>use protected key access with in the package.

public–>use public key access in any package.

private–>use private key with in class.

Example: Main reason is a data protecting and data hiding

class Bank
{ 
int interest =5;
private int salary = 5000;
public static void main(String[] args)
{
Bank rep = new Bank();
rep.deposit();
rep.withdraw();
rep.promote();
System.out.println(rep.interest);
System.out.println(rep.salary);
}
private void promote()
{
 System.out.println("Interest Activity");
}
public void deposit()
{
 System.out.println("deposit");
}
public void withdraw()
{
 System.out.println("withdraw");
}
}

Machine learning

machine learning was ideated first in 1943 by logical walter pitts and neuroscientist warren mcculloch

machine learning is a type of Ai that allows software applications to become more accurate at predicting to do so. machine learning algorithms yse historical data as input to predict new values.

robot Based on the knowledge it will be work is known as artificial intelligence.

Artificial intelligence is work automatically incase any problems to works in Artificial intelligence its solved the all problems automatically and then done it works.

If the machine will be learning it-self the programming is the rewritten. the program changed automatically is called machine learning programming language.

What is machine learning:

.

traditional program:

Data + program = Output

Machine learning programing

Data + Output = program

learn from data + learn from experience = program modified based on output.

learn from data and experienced from output . if we can modified the program is called machine learning programming.

How machine learning works?

why machine learning:

The growth of machine learning has been proplled by the immense amount of available data, affordable data storage, and more powerful and less expansive data processing. today industries are coming up with robust machine learning models to analyze bigger and more complex data. the robust model also deliver faster and more accurate results.

types of ML

supervised machine learning

unsupervised ML

semi-supervised ML

reinforcement learning

1)supervised machinelearning is based oon supervision

the main goal of the supervised learning technique is to map the input variables with the outpur variables.

2)unsupervised ML

the main aim of unsupervised learning algorith is to group or categories the unstored dataset according to the similarities,patterns, and differences

3)semi-supervised learning

is a type of machine learning algorith that lies between supervised and unsupervised machine learning.

4)reinforcement learning

it based process in which an AI agebt automatically explore its surrounding by hitting .

Swapping four number:

Why we use swapping four numbers:

Swapping is used to variables to refresh to mutual exchanging the values of the variables. Generaly, this is done with the data in memory. The simplest method to swap four variables using without fifth temporary variables.

Example:

public class Swappingfour
{
public static void main(String[] args)
{
	int no1= 10;
	int no2= 20;
	int no3 = 30;
	int no4=40;
	 no1=no3-no1;
	 no4=no4-no3;
	 no3=no1+no2;
	 no2=no4+no1;
	 {
		 System.out.println(no1);
		 System.out.println(no2);
		 System.out.println(no3);
		 System.out.println(no4);
	 }
}
}

output:

Swapping with three number:

What is swapping three numbers:

Given three numbers, swap them in cyclic form. First number should get the value of third, second should get the value of first and third should get value of second.

Example:

public class SwappingThree 
{
public static void main(String[] args)
{
	int no1=10;
	int no2=20;
    int no3=30;
	no1=no3-no1;
	no3=no3-no1;
	no2=no1+no3;
	{
		System.out.println(no1);
		System.out.println(no2);
		System.out.println(no3);
	}
}
}

output:

Swapping two number in java:

What is swapping in java:

In computer programming, the act of swapping two variables refers to mutually exchanging the values of the variables. Usually, this is done with the data in memory.

Swapping with two numbers:

Swapping two number in C programming language means exchanging the values of two variables. Suppose you have two variable var1 & var2.

Example:

public class Swapping 
{
 public static void main(String[] args)
 {
	 int no1 = 10;     
	 int no2 = 20;
	 no1= no1+no2;  //10=10+20=30 (no1=30)
	 no2 = no1-no2; //20=30-20 =10 (no2=10)
	 no1 = no1-no2; //30=30-10 = 20 (no1=20)
	 { 
	 System.out.println(" no1 is "+ no1);
	 System.out.println(" no2 is "+ no2);
	 }
}
}

output: