Skip to content

Instantly share code, notes, and snippets.

View Suhaib3100's full-sized avatar
🌐
Working on Saas Project

Suhaib King Suhaib3100

🌐
Working on Saas Project
View GitHub Profile
Below is the SQL solution for the given airline schema with complete explanations for each query:
a) Create Tables with Primary Keys and Foreign Keys
CREATE TABLE Flights (
flno INTEGER PRIMARY KEY,
from_city VARCHAR(50),
to_city VARCHAR(50),
distance INTEGER,
departs TIME,
@Suhaib3100
Suhaib3100 / Dbms
Created December 17, 2024 07:07
2nd
Here is the solution for the Sailors database schema:
a) Create the tables by specifying primary keys and foreign keys:
CREATE TABLE Sailors (
sid INTEGER PRIMARY KEY,
sname VARCHAR(50),
rating INTEGER,
age REAL
);
Here is a simpler explanation and approach for the selected SQL tasks:
c) Find aircraft names where all pilots certified to operate them earn more than 80,000
Simplified Query:
SELECT a.aname
FROM Aircraft a
JOIN Certified c ON a.aid = c.aid
JOIN Employees e ON c.eid = e.eid
@Suhaib3100
Suhaib3100 / all.py
Created December 15, 2024 13:12
pythonfinal
1.StarCase
# Read the size of the staircase
n = int(input())
# Loop to build the staircase
for i in range(n):
# Calculate the number of leading spaces and # symbols
spaces = ' ' * (n - i - 1) # Number of spaces
hashes = '#' * (i + 1) # Number of hashes
@Suhaib3100
Suhaib3100 / Logger.py
Last active December 4, 2024 09:23
Example Event Logger
import time
from datetime import datetime
# Log an event with the current timestamp
def log_event(event):
current_timestamp = time.time() # Get the timestamp
readable_time = datetime.fromtimestamp(current_timestamp).strftime("%Y-%m-%d %H:%M:%S")
print(f"[{readable_time}] Event: {event}")
# Example usage
@Suhaib3100
Suhaib3100 / Ex5.py
Created December 4, 2024 09:19
Example 4 formatting timestamps
# Get the current datetime
now = datetime.now()
# Format it into a readable string
formatted_date = now.strftime("%Y-%m-%d %H:%M:%S")
print("Formatted Date:", formatted_date)
@Suhaib3100
Suhaib3100 / Ex3.py
Created December 4, 2024 09:16
Ex 3 convert readable into timestamps
# Create a datetime object
dt = datetime(2024, 12, 4, 15, 0, 0)
# Convert datetime to timestamp
timestamp = dt.timestamp()
print("Timestamp:", timestamp)
@Suhaib3100
Suhaib3100 / ex2.py
Created December 4, 2024 09:15
Timestamps 2 converting into teadable
from datetime import datetime
# Example timestamp
example_timestamp = 1701739200 # Example: Dec 4, 2024
# Convert timestamp to datetime
converted_datetime = datetime.fromtimestamp(example_timestamp)
print("Readable Date and Time:", converted_datetime)
@Suhaib3100
Suhaib3100 / ex.py
Created December 4, 2024 09:13
Timestamps
import time
# Get the current timestamp
current_timestamp = time.time()
print("Current Timestamp (seconds since epoch):", current_timestamp)