Concept explainers
I need SQL code for the following question :
Create a MySQL table named 'prime_test' that contains two columns. The first column is an integer named 'number' that is the primary key and cannot be NULL. The second column is a variable length string named 'is_prime' with a maximum length of 50.
Write one or more insert statements that fills only the 'number' column of table 'prime_test' with the integers between 2 and 100.
Write one or more update statements that sets the 'is_prime' column for each associated integer. For a prime, the column should read 'prime'. For non-primes, the column should read 'composite'.
Write a final select statement to return only the 'number' column from 'prime_test' for records that are prime, ordered from largest to smallest.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Its giving me an error in where statement saying isprime and !isprime doesn't exit
Thanks, It was really helpful, Is there way to interest the values using loop?
Its giving me an error in where statement saying isprime and !isprime doesn't exit
Thanks, It was really helpful, Is there way to interest the values using loop?
- Employee SearchCreate an application that connects to the Personnel.mdf database that you created in Programming Problem 1. The application's form should display the Employee table in a DataGridView control. The application should let the user specify a name in a text box and then search for that name in the Employee table. The application should display any rows that contain a full or partial match of the specified name. Need help with my code. Not properly pulling up the names. SQL code: SELECT Id, Name, Position, HourlyPay FROM dbo.Employee WHERE Name LIKE '%' C# Code: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms; namespace Name_Search{public partial class Form1 : Form{public Form1(){InitializeComponent();} private void employeeBindingNavigatorSaveItem_Click(object sender, EventArgs…arrow_forwardTask 5: Create the GET_CREDIT_LIMIT procedure to obtain the full name and credit limit of the customer whose ID currently is stored in I_CUST_ID. Place these values in the variables I_CUSTOMER_NAME and I_CREDIT_LIMIT, respectively. When the procedure is called it should output the contents of I_CUSTOMER_NAME and I_CREDIT_LIMIT.arrow_forwardWrite a stored procedure called sp_apply_discount() that will apply percent discount to books in a subject. The stored procedure takes in 2 parameters, percentDiscount (DECIMAL(8,2)) and subject (VARCHAR(120)). Using these parameters, the stored procedure computes the discount for the book cost and stores it in the FINAL_PRICE field. For example, the following stored procedure call: call sp_apply_discount(0.15, 'Database');would compute 15% percent discount from the book cost in the Database subject category and store it in the FINAL_PRICE column as depicted in this image:arrow_forward
- The Movie table has the following columns: ID - positive integer Title - variable-length string Genre - variable-length string RatingCode - variable-length string Year - integer Write ALTER statements to make the following modifications to the Movie table: Add a Producer column with VARCHAR data type (max 50 chars). Remove the Genre column. Change the Year column's name to ReleaseYear, and change the data type to SMALLINT.arrow_forwardThird normal form says: a. No nonkey columns depend on another nonkey column. b. Every column that's not part of the primary key is fully dependent on the primary key. c. Eliminate repeated fields. d. None of the above.arrow_forwardThis kind of code gives me errors i have more info below. My codeDELIMITER //CREATE PROCEDURE GET_INVOICE_DATE (in I_INVOICE_NUM CHAR(5))DECLARE I_CUST_ID CHAR(5),DECLARE I_CUST_NAME VARCHAR(41),DECLARE I_INVOICE_DATE DATE BEGIN SELECT c.CUST_ID, CONCAT(c.FIRST_NAME, ' ', c.LAST_NAME), i.INVOICE_DATE INTO I_CUST_ID, I_CUST_NAME, I_INVOICE_DATE FROM INVOICES i INNER JOIN CUSTOMER c ON i.CUST_ID = c.CUST_ID WHERE i.INVOICE_NUM = I_INVOICE_NUM; END // Delimiter ; Helpfull info Task #6 – same process as Task #5• Procedure name is GET_INVOICE_DATE with I_INVOICE_NUM in parentheses with 5 characters• There should be 3 declare statements for I_CUST_ID CHAR(5); I_CUST_NAME VARCHAR(41); andI_INVOICE_DATE DATE is datatype• SELECT statement should include the CUSTOMER.CUST_ID, CONCAT for first_name andlast_name AS customer_name, invoice_date• INTO the 3 “I” fields in the declare statement• From should include the CUSTOMER and INVOICES tables• Where clause to join CUSTOMER.CUST_ID =…arrow_forward
- The following statements are executed by the given order. create table book (book_id number primary key, book_name varchar2(32) not null, book_isbn varchar2(13) not null); insert into book values (123, 'My first book', 1234); What is the outcome ? The table BOOK is created and a row is inserted. The table BOOK is created and a row NOT is inserted. The table BOOK NOT is created and a row is inserted. The table BOOK NOT is created and a row is NOTinserted.arrow_forwardIn cell B12, create a nested formula using the AVERAGE and ROUND functions to first find the average number of clothing sets sold in January (the range B6:B9), and then round the answer to 0 digits. Copy the formula from cell B12 to the range C12:N12.arrow_forwardIn Android Studio, db is a SQLiteDatabase reference; sql is a String representing a delete SQL statement. Write a statement to execute that SQL statement.arrow_forward
- The Horse table has the following columns: ID - integer, primary key RegisteredName - variable-length string Breed - variable-length string Height - decimal number BirthDate - date Write a SELECT statement to select the registered name, height, and birth date for only horses that have a height between 15.0 and 16.0 (inclusive) or have a birth date on or after January 1, 2020. -- Your SELECT statement goes hereSELECT *FROM HorseWHERE (Height >= '15.0' AND Height <= '16.0') OR BirthDate >= '2020-01-01';arrow_forwardThe Sqlite.py file contains several very specific queries: select_Query = "select sqlite_version()" delete_query = "DELETE from Database where id = "+str(id) sel = 'SELECT id FROM Database WHERE name == "{0}"'.format(value) insert_query = """INSERT INTO Database (id, name, photo, html) VALUES (?, ?, ?, ?)""" sqlite_select_query = """SELECT * from Database""" table_query = '''CREATE TABLE Database ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, photo text NOT NULL UNIQUE, html text NOT NULL UNIQUE)''' Write a QueryBuilder function. The QueryBuilder builds a generic Query to build ANY Query type (i.e. version, delete, select, insert, select, table). The QueryBuilder parameters require: The type of Query, the input tuple data and then constructs a query string based on the parameters.…arrow_forward10. Create an anonymous block which will convert a number grade to a letter grade. Prompt for a number grade. Display a CHAR value back to the screen. Usethe following rules:• A: 90 or above• B: >=80 and <90• C: >=70 and < 80• D: >=60 and < 70• F: <60 Note. This is Oracle sql question and please give response in Oracle sqlarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY