Skip to main content

SQL Queries


create database school_data;
use school_data;

create table admins
(first_name varchar(20) Not Null, 
middle_initial varchar(1) Not null, 
last_name varchar(20) NOt NULL, 
DOB varchar(10) NOt NULL, 
phone varchar(10) Primary key, 
alt_phone varchar(10), 
email varchar(150) NOt NULL, 
designation varchar(60) NOt NULL, 
subjects_taken varchar(150), 
classes_taken varchar(20));

create table class_teachers
(first_name varchar(20) Not Null, 
middle_initial varchar(1) Not null, 
last_name varchar(20) NOt NULL, 
DOB varchar(10) NOt NULL, 
phone varchar(10) Primary key, 
alt_phone varchar(10), 
email varchar(150) NOt NULL, 
subjects_taken varchar(150), 
class_teacher_of varchar(2) Not Null, 
classes_taken varchar(20));

create table student_stats
(ADMISSION_NO varchar(15) PRImary key,
ROLL_NO int NOt NULL,
GRADE varchar(10) NOt NULL,
SECTION varchar(1) NOt NULL,
DOB varchar(10) NOt NULL,
FIRST_NAME varchar(30) NOt NULL,
FATHERS_NAME varchar(30),
MOTHERS_NAME varchar(30),
LAST_NAME varchar(30) NOt NULL,
BLOOD_GROUP varchar(4),
ADDRESS varchar(200) NOt NULL,
PHONE varchar(10) Not Null,
MOBILE_ALTERNATE varchar(10),
GMAIL varchar(100) Not Null,
IN_BOARDS varchar(3),
STREAM varchar(12),
SUBJECTS_TAKEN varchar(150));

CREATE TABLE grade1
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade2
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade3
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade4
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade5
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade6
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade7
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade8
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade9
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade10
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade11
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));

CREATE TABLE grade12
(ADMISSION_NO VARCHAR(15), 
NAME VARCHAR(100), 
FOREIGN KEY (ADMISSION_NO) 
REFERENCES STUDENT_STATS(ADMISSION_NO));


============================================================================================================================================

create database hospital_management;
use hospital_management;

create table user_auth
(PATIENT_ID Varchar(30) Primary Key,
PWD varchar(15) Not Null);

create table appointments
(PATIENT_ID Varchar(30) NOT NULL,
TIMESTAMP DATETIME,
FOREIGN KEY(PATIENT_ID)
REFERENCES USER_AUTH(PATIENT_ID));

create table patients
(PATIENT_ID VARCHAR(30) NOT NULL,
NAME VARCHAR(50) NOT NULL,
MOBILE VARCHAR(13) NOT NULL,
FOREIGN KEY (PATIENT_ID)
REFERENCES USER_AUTH(PATIENT_ID));

create table due_bills
(PATIENT_ID Varchar(30) NOT NULL,
AMOUNT INT,
FOREIGN KEY(PATIENT_ID)
REFERENCES USER_AUTH(PATIENT_ID));


============================================================================================================================================


print('\n\nPRESS \'d\' TO CAPTURE IMAGE.\n\
MAKE SURE THAT CAPSLOCK IS TURNED OFF.\n\
NOTE: OPEN THE NEW WINDOW APPEARED IN TASKBAR.')
line 85 above "while True:"

>> use .lower() in add_new_stud and staff for the input of ensuring mobile numbers are correct and for ensuring data to be added in add_new_std.

print("""
_____________________________________________________________________
|-------------------------------------------------------------------|
| AVAILABLE COMMANDS |
| |
| 1.) If you want all details for this student, Enter "all". |
| 2.) For getting Contact Details, Enter "contact". |
| 3.) If you want to delete all data permanently, Enter "delete". |
| 4.) If you want to quit, Enter "quit". |
| |
|___________________________________________________________________|
""")
remove this from if_match and paste in existing_stud

>> use <or '1','2','3' and '4' > with task name to prevent misunderstanding of running task and do the same for existing_staff.

match found then print this above imshow in unknown face check.
print("\n\nCLOSE THE RESULT WINDOW TO PROCEED AHEAD.")

+======================================================================================================================================================================================================================================================================================================
CREATE DATABASE ATM;

USE ATM;

CREATE TABLE ACCOUNTS
(CardNo VARCHAR(20) PRIMARY KEY,
PIN VARCHAR(4) NOT NULL,
NAME VARCHAR(30) NOT NULL,
BALANCE INT,
STATEMENT VARCHAR(100));

 

Comments

Popular posts from this blog

How To Make Proper Mindset for IIT-JEE

As I said Before in " Getting Started ", You are not a topper even if you had scored 99.99% in Board Exams Of Class 10th. Because in JEE, You have to tackle many obstacles and pass through many difficult situations and you might feel like depression since you have a great competition in front of you. You never had some very strong mindset to achieve something before 11th std but now you have to because now you are entering into a race. If you stop you lose, and if you continue till the end you win. The Most Important is to make your mindset proper and so strong that you can't divert from it by yourself and, even don't let anybody do so. You must have that passion to do something that makes you wake up the moment your alarms rings in the early morning. You must that one strong feeling or reason to do this, which will let you continuously do whatever you are doing. And Consistency is the key to success, so just keep it up and neither lose your self-confidence nor let i...

7 ways to stay focused on IIT-JEE / Standardized Tests

7 Ways To Stay Focused &  Reach Your Goal Stop Multitasking:-   We all want to complete our all tasks but you have to understand, is it necessary to complete them all together. Your mind is much stressed out when you do multitasking and for your mental health, you have to be so aware of nutrition and all. Especially when you had improper sleep your mind is already stressed out so you must not do multitasking at these times. Try to achieve completion in a single task, it will arise some satisfaction for you that you have completed one task. Whereas, if you do multitasking, things will take time to get completed, and this might make you uncomfortable and demoralized. So, I recommend you to do one task at a time and not to multi-task. Block Out Your Days:- Blocking out days is referring to fix some time period for a particular task and this is going to make a great impact on your work attitude and preparation for IIT-JEE too. Try to make some routine such as you must hav...

INTELLIGENT AGENTS

In this section,  we will be discussing the nature of agents. Are they perfect? What are the different environments? And what are the resulting diversity of agent types? So, If you have not yet understood what Artificial Intelligence is, then go and check out "WHAT IS ARTIFICIAL INTELLIGENCE," and after you have an idea about the formal definition of AI, come back here. Here we go! let's start our next section. Click the link below! Click here to start learning about Agents and Environments. And if you haven't yet bought the book I suggest, click on the below to buy it from Amazon. Buy it on Amazon.in (For India): Buy Hardcover Book or Paperback on Amazon.com from the links down below. (For US)