Recent programs

lab2:

an anonymous user · May 26, 2022 · SQL
create table salesman(
salesman_id varchar(10),
Name varchar(10),
city varchar(10),
comission float,
primary key(salesman_id)
);
create table customer(
cust_id varchar(10),
cust_name varchar(10),
city varchar(10),

lab2:

an anonymous user · May 26, 2022 · SQL
create table salesman(
salesman_id varchar(10),
Name varchar(10),
city varchar(10),
comission float,
primary key(salesman_id)
);
create table customer(
cust_id varchar(10),
cust_name varchar(10),

emp dept sql

an anonymous user · May 26, 2022 · SQL
create table emp(id int,deptid int,sal int);

create table dept(deptid int,name varchar(10));

insert into emp values(1,1,1),(2,1,2),(3,1,4),(4,2,5),(5,2,8),(6,2,1);

insert into dept values(1,'a'),(2,'b');

select did from(
select avg(e.sal) avgsal,e.deptid  did from emp e join dept d

MYSQL employees

an anonymous user · May 26, 2022 · SQL
-- create a table
CREATE TABLE `employees` (
  `id` int(11) NOT NULL,
  `managerId` int(11) DEFAULT NULL,
  `name` varchar(30) NOT NULL
) ;
-- insert some values
INSERT INTO `employees` (`id`, `managerId`, `name`)
VALUES	(1,1,'John'),	(2,1,'Sam'),	(3,2,'Mike');

-- Write your Query here

accessmodifiers.php

an anonymous user · May 26, 2022 · PHP
<?php

class A{
    protected $a=120;
    protected $b=100;
    protected $c=130;
    
    function sum(){
        
     $add=$this->a+$this->b+$this->c;
      echo $add;

sample

Teodoro · May 26, 2022 · SQL
CREATE DATABASE testDB;

accessmodifiers.php

an anonymous user · May 26, 2022 · PHP
<?php

class A{
    public $a;
    public  $b;
    public $c;
    
    function sum(){
        
     $add=$this->a+$this->b+$this->c;
      echo $add;

Rough.java

an anonymous user · May 26, 2022 · Java
public class Rough{
public static void main(String[]
args) {

String str = "hi this is java language";

for (int i = 0; i < str.length() - 1; i++) {

int count = 0;

for (int j =i+1; j < str.length(); j++) {

AMAN

an anonymous user · May 26, 2022 · SQL
-- create a table
CREATE TABLE students (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  gender TEXT NOT NULL
);
-- insert some values

alter TABLE  students ADD ROLLNO INTEGER;
INSERT INTO STUDENTS VALUES (3, 'AMAN','F',44);
SELECT * FROM STUDENTS;

Sss

an anonymous user · May 26, 2022 · SQL
-- create a table
CREATE TABLE students (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  gender TEXT NOT NULL
);
-- insert some values
INSERT INTO students VALUES (1, 'Ryan', 'M');
INSERT INTO students VALUES (2, 'Joanna', 'F');
-- fetch some values
SELECT * FROM students WHERE gender = 'F';

revise

an anonymous user · May 26, 2022 · R
v1= c(1,2,3,4,5,6)
print(range(v1))
print(mean(v1))
print(median(v1))
print(var(v1))
print(sd(v1))
print("__FUNCTION__")
new.function<- function(a,b=10){

    print(a)
    print(b)

Ch-1:Practice Set Q1

an anonymous user · May 26, 2022 · C
//Write a C Program to Calculate the area of a rectangle:
//1.Using hardcoded inputs  2.Using input supplied by the user

/* 1. #include <stdio.h>

int main() 
{
    int length=3,breadth=5,area=length*breadth;
    
    printf("The area of the Rectangle is %d\n",area);
    return 0;

sabve

an anonymous user · May 26, 2022 · SQL
-- create a table
-- CREATE TABLE students (  id INTEGER PRIMARY KEY,  name TEXT NOT NULL,  gender TEXT NOT NULL);
-- insert some values
-- INSERT INTO students VALUES (1, 'Ryan', 'M');
-- INSERT INTO students VALUES (2, 'Joanna', 'F');
-- fetch some values
SELECT * FROM students ;

Mysql Seller Rating

an anonymous user · May 26, 2022 · SQL
-- create a table
CREATE TABLE `items` (
  `id` int(11) NOT NULL,
  `name` varchar(30) NOT NULL,
  `sellerId` int(11) DEFAULT NULL);
CREATE TABLE `sellers` (
  `id` int(11) NOT NULL,
  `name` varchar(30) NOT NULL,
  `rating` int(11) NOT NULL);
-- insert some values
INSERT INTO `items` (`id`, `name`, `sellerId`) VALUES(1,'Notebook',2),(2,'Stapler',1),(3,'Pencil',2);

G6=2

an anonymous user · May 26, 2022 · R
 l = list()
for (i in 1:5) l[[i]] <- c(i, 1:4)
print("List of vectors:")
print(l)
result = do.call(rbind, l)
print("New Matrix:")
print(result)

SAMPLE

an anonymous user · May 26, 2022 · SQL
CREATE TABLE Faculty(
  id int PRIMARY KEY,
  name varchar(20) NOT NULL,
  DOJoin DATE NOT NULL,
  Age int NOT NULL,
  Deptid int NOT NULL
  );

INSERT INTO Faculty(id,name,DOJoin,Age,Deptid)
VALUES
(2690,"Kamal","19-06-2021",40,1110),

SAMPLE

an anonymous user · May 26, 2022 · SQL
CREATE TABLE Faculty(
  id int PRIMARY KEY,
  name varchar(20) NOT NULL,
  DOJoin DATE NOT NULL,
  Age int NOT NULL,
  Deptid int NOT NULL
  );

INSERT INTO Faculty(id,name,DOJoin,Age,Deptid)
VALUES

copy.sh

an anonymous user · May 26, 2022 · Bash
#!/bin/bash
echo "Enter a source file name"
read f1
cat>$f1
echo "Enter a destination file name"
read f2
cat>$f2

cp $f1 $f2

echo "Source file content"

calculator

an anonymous user · May 26, 2022 · Bash
declare -i c=1
for m in {1..12}; do
  a=$(date -d "$m/1 + 1 month -1 day" "+%b - %d days";)
  if [ $m -le 7 ]
  then
    [[ "$a" = *"31 days"* ]] && echo "$a" && c+=1
  fi
done

copy.sh

an anonymous user · May 26, 2022 · Bash
#!/bin/bash
echo "Enter a source file name"
read f1
cat>$f1
echo "Enter a destination file name"
read f2
cat>$f2

cp $f1 $f2

echo "Source file content"