Consider the following table and Do as Directed

Consider the following table and Do as Directed SOLUTION .   DECLARE v_prod_no Product.Prod_No%TYPE; v_price Product.Price_per_Unit%TYPE; v_quantity Product.Quantity_Sold%TYPE; v_total_sale Product.Total_Sale%TYPE; BEGIN — Accept product number from user v_prod_no := &prod_no; — Retrieve price per unit and quantity sold for the given product SELECT Price_per_Unit, Quantity_Sold INTO v_price, v_quantity FROM Product WHERE Prod_No = v_prod_no; — […]

Write PL/SQL block that will accept employee number from user and deduct an amount of Rs.200 from the inputted employee, if he has a salary less than 1000 after Salary is deducted, it display message‘s Salary is less than 1000’. The process is to be fired on table employee (emp_no, name, salary).

Write PL/SQL block that will accept employee number from user and deduct an amount of Rs.200 from the inputted employee, if he has a salary less than 1000 after Salary is deducted, it display message‘s Salary is less than 1000’. The process is to be fired on table employee (emp_no, name, salary). solution. DECLARE v_emp_no […]

Q.1 Create following tables using create statement with appropriate constraint and do the followings.

Q.1 Create following tables using create statement with appropriate constraint and do the followings. Q : 1 Create following tables using create statement with appropriate constraint and do thefollowings.Artist(aid, fname, lname)Paintings(pid,pname,aid,listed_price) Solution. CREATE TABLE Artist ( aid NUMBER PRIMARY KEY, fname VARCHAR2(50) NOT NULL, lname VARCHAR2(50) NOT NULL ); CREATE TABLE Paintings ( pid NUMBER […]

Write a Python program to calculate the sum of digits of a number.

Write a Python program to calculate the sum of digits of a number. SOLUTION. # Taking dynamic input from the user num = int(input(“Enter a number: “)) # Calculating the sum of digits sum_of_digits = sum(int(digit) for digit in str(abs(num))) # Convert number to string, iterate over digits, and sum them # Displaying the result […]

Write a Python program to find the largest number in a NumPy array

Write a Python program to find the largest number in a NumPy array SOLUTION. import numpy as np # Taking dynamic input for array size n = int(input(“Enter the number of elements in the array: “)) # Taking dynamic input for array elements arr = np.array([float(input(f”Enter element {i+1}: “)) for i in range(n)]) # Finding […]

Write a program to find the number of key-value pairs in a dictionary

Write a program to find the number of key-value pairs in a dictionary SOLUTION. # Creating an empty dictionary my_dict = {} # Taking dynamic input from the user n = int(input(“Enter the number of key-value pairs: “)) # Adding key-value pairs dynamically for i in range(n): key = input(f”Enter key {i+1}: “) value = […]

Create a dictionary that contains another dictionary as a value. Access the nested dictionary value.

a SOLUTION. # Creating a dynamic nested dictionary with user input student = { “name”: input(“Enter student’s name: “), “details”: { “age”: int(input(“Enter student’s age: “)), “grade”: input(“Enter student’s grade: “), “city”: input(“Enter student’s city: “) } } # Display the entire dictionary print(“nStudent Dictionary:”, student) # Accessing nested dictionary values print(“Student’s name:”, student[“name”]) print(“Student’s […]

Create list and perform append, pop, and slice operation.

Create list and perform append, pop, and slice operation. SOLUTION. # Creating an empty list my_list = [] # Taking dynamic input from the user n = int(input(“Enter the number of elements you want in the list: “)) # Appending elements to the list for i in range(n): element = input(f”Enter element {i+1}: “) my_list.append(element) […]

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.