Skip to content

Instantly share code, notes, and snippets.

View theabhayprajapati's full-sized avatar
:electron:

Abhay Prajapati theabhayprajapati

:electron:
View GitHub Profile
@theabhayprajapati
theabhayprajapati / practical_2.sql
Last active September 7, 2022 16:38
This file contains the procedure for 2nd Practical of Computer.
USE C4042;
CREATE TABLE Employee(
Empno INT,
FirstName VARCHAR(20),
LastName VARCHAR(20),
Address VARCHAR(100),
City VARCHAR(25),
Desgn VARCHAR(25),
DeptId INT,
SELECT Empno,FirstName,LastName, DeptId FROM Employee ORDER BY FirstName;
SELECT Empno,FirstName,LastName, DeptId FROM Employee ORDER BY LastName, FirstName;
SELECT Empno,FirstName,LastName, DeptId FROM Employee WHERE LastName LIKE '%H%';
SELECT Empno,FirstName,LastName, DeptId FROM Employee WHERE SUBSTR(LastName,3,1) = 'H';
SELECT DISTINCT City FROM Employee;
SELECT Empno,FirstName,LastName, DeptId FROM Employee WHERE Salary BETWEEN 30000 AND 45000;
SELECT Empno,FirstName,LastName, City FROM Employee WHERE City NOT IN ('Mumbai','Pune');
SELECT DeptId, SUM(Salary), AVG(Salary), MAX(Salary), MIN(Salary) FROM Employee GROUP BY DeptId;
SELECT Empno, LOWER(FirstName), UPPER(LastName), SUBSTR(LastName,3,4) FROM Employee;
SELECT Empno, CONCAT(FirstName, ' ', LastName) AS Name FROM Employee;
@theabhayprajapati
theabhayprajapati / mysql.md
Last active September 7, 2022 18:25
All notes for mysql computer lecture.

MySql Notes

Data Types

CHAR(n) - all characters should be n size. VARCHAR(n) - all characters can less than n size. TEXT - unlimited size. INT - integer. BIGINT - big integer. FLOAT - float. DOUBLE - double.

SELECT e.Empno, e.LastName, d.DeptName from Employee e, Department d WHERE e.DeptID = d.DeptId ORDER BY d.DeptName,e.LastName DESC;
SELECT e.lastName, d.DeptID, d.DeptName from Employee e, Department d WHERE e.DeptID = d.DeptId;
SELECT DISTINCT desgn from Employee where DeptId = 1;
SELECT e.LastName, d.DeptName from Employee e, Department d WHERE e.LastName LIKE '%a%' AND e.DeptId = d.DeptID;
SELECT e.LastName, d.DeptName, d.City from Employee e, Department d WHERE e.DeptId = d.DeptId AND e.desgn = 'Manager' ORDER BY e.Empno;
SELECT CONCAT(e.FirstName, " ", e.LastName) "Employee", CONCAT(m.LastName, " ", m.FirstName) FROM Employee m INNER JOIN Employee e ON m.Desgn="Manager" AND e.DeptID = m.DeptId;
select d.DeptName, Min(salary) "Minimum Salary", Max(Salary) "Maximum Salary" from employee e, department d where e.DeptId=d.DeptId group by e.deptId;
SELECT Desgn, COUNT(Desgn) FROM Employee GROUP BY Desgn;
SELECT Desgn, MIN(Salary), MAX(Salary), SUM(Salary), AVG(Salary) FROM Employee GROUP BY Desgn;
SELECT MAX(Salary) - MIN(Salary) AS 'Range of Salary' FROM Employee;
select m.Empno "Manager ID", e.Salary "Minimum Salary" from Employee m, Employee e where e.DeptId=m.DeptId AND m.Desgn ="Manager" AND e.Salary = (select MIN(Salary) from Employee where DeptID=m.DeptId) ORDER BY e.FirstName DESC;
select d.deptId, empno, concat(FirstName, " ", LastName) "Employee Name", Salary from Employee d INNER JOIN Department e on d.deptId =e.deptId WHERE salary>(select AVG(salary) from Employee);
@theabhayprajapati
theabhayprajapati / CaesarCipher.java
Created September 1, 2022 14:29
Made a Algorithm for cryptography using principles of Caedar Cipher, where we want to encrypt a message then for that we make a key and for every letter in the message we increase it's alphabet with +key letter e.g for "a" and key is 10 then the encrypt word will be "k".
package DataStructures;
public class CaesarCipher {
static String encrypt(String msg, int key){
StringBuilder encrypted = new StringBuilder(msg);
String alphabets = "ABCDEFGHIJKLMNOPQRSTVUWXYZ";
String smallalphabets = alphabets.toLowerCase();
String shiftedAplhabets = alphabets.substring(key) + alphabets.substring(0, key);
for( int i =0; i< encrypted.length(); i++){
char curChar = encrypted.charAt(i);
@theabhayprajapati
theabhayprajapati / induction.py
Created September 2, 2022 06:55
Prove by mathematical induction n(n+1)(n+2) is divisible by 24
""" prove by mathematical induction n(n+1)(n+2) is divisible by 24 """
def main(n):
""" main function """
if n * (n + 1) * (n + 2) % 6 == 0:
print(n, "is divisible by 6")
return main(n + 1)
else:
print(n, "is not divisible by 6")
n += 1
return main(n)
@theabhayprajapati
theabhayprajapati / Companies.md
Last active June 17, 2024 07:49
List of 300+ Companies paying 12LPA+ base for SDE-1 role in India.

List of 300+ Companies paying 12LPA+ base for SDE-1 role in India.

source

Companies have been listed with their URLs so you can easily access their website. We would appreciate it if you could comment below with the correct URL if you find any that are broken.

  1. Acko
  2. Adobe
  3. Airbase
  4. Airbnb
  5. Airbus
@theabhayprajapati
theabhayprajapati / Main.java
Created September 6, 2022 14:28
CODE THAT HELPED ME TO MAKE THE COMPANIES.MD FILE GIST Written in Java.
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) {
/*read lines from fle adn conver in tor array*/
String[] lines = new String[0];
create table student(rno int(5) primary key, name varchar(10) not null, address varchar(30), phone varchar(10));
create table marks(rno int(5), maths int(3), cs int(3), phy int(3), bio int(5), chem int(5));
insert into student values (1, "Abhay", "Bengaluru", "1000000000"), (2,"Arin","Hyderabad", "2000000000"), (3,"Om", "Pune", "3000000000"),(4, "Asha", "Mumbai", "5000000000"), (5, "Kapil", "Delhi", "5000000000");
insert into marks values (1, 234, 432,354, 456, 343), (2,453,655,654,765,134), (3, 382,891,329,839,177),(4,928,314,533,242,659),(5,392,432,565,732,676);
select s.rno "Roll Number", name "Name", SUM(maths+cs+phy+bio+chem) "Total Marks" from student s inner join marks m on s.rno=m.rno group by s.rno;