| Database systems | Assignment # 1 | Areeba kamil (34421) | BSCS 4A | 10/4/2015 | 4.7. Consider the LIBRARY relational database schema shown in Figure 4.6. Choose the appropriate action (reject,cascade,set to NULL,set to default) for each referential integrity constraint, both for the deletion of a referenced tuple and for the update of a primary key attribute value in a referenced tuple.Justify your choices. CREATE DATABASE library; CREATE TABLE book( book_id int, title varchar(50)
Words: 1569 - Pages: 7
records which combines each row from the first table with each row of the second table. Cross JOIN Syntax is, SELECT column-name-list from table-name1 CROSS JOIN table-name2; Example of Cross JOIN The class table, ID | NAME | 1 | abhi | 2 | adam | 4 | alex | The class_info table, ID | Address | 1 | DELHI | 2 | MUMBAI | 3 | CHENNAI | Cross JOIN query will be, SELECT * from class
Words: 1005 - Pages: 5
Week 4 Melissa Maxwell Assignment Chapter 8 1. CREATE TABLE CUSTOMER CUST_NUM NUMBER PRIMARY KEY, CUST_LNAME VARCHAR CUST_FNAME VARCHAR CUST_BALANCE NUMBER; CREATE TABLE CUSTOMER_2 CUST_NUM NUMBER PRIMARY KEY, CUST_LNAME VARCHAR, CUST_FNAME VARCHAR CREATE TABLE INVOICE INV_NUM NUMBER PRIMARY KEY, CUST_NUM NUMBER, INV_DATE DATE, INV_AMOUNT NUMBER); 2. INSERT INTO CUSTOMER VALUES (1000, ‘SMITH’, JEANNE’ 11050.11); INSERT INTO CUSTOMER VALUES(1001, ‘ORTEGA’, ‘JUAN’ 840.92); INSERT INTO CUSTOMER_2
Words: 1092 - Pages: 5
MGS 8020 Business Intelligence Assignment 3 Please use the SQL (in MS Word) to answer the following questions. You may use subquery but all questions need to be completed in ONE SQL. You need to use the following tables (STUDENT and GPA) to answer Q1 – Q4. [pic] 1. What is the output if you have the following SQL? (10 points) Select * from STUDENT; Uncondition SQL that lists all the students from the student table with the respective columns. Select
Words: 438 - Pages: 2
SELECT column_list FROM table-name [WHERE Clause] [GROUP BY clause] [HAVING clause] [ORDER BY clause]; SELECT name, salary, salary*1.2 AS new_salary FROM employee WHERE new_salary /salary*1.2 > 30000; SELECT first_name, last_name, subject FROM student_details WHERE subject IN/NOT IN ('Maths', 'Science'); Select * from product p where EXISTS (select * from order_items o where o.product_id = p.product_id) -------------------------------------------------
Words: 652 - Pages: 3
ALTER PROCEDURE [dbo].[ASP_Weekly_Lift_Report] @Voyage_Start Varchar(3) = Null, @Voyage_End Varchar(3) = Null, @Sales_Rep Varchar(25) = Null, @Service Varchar(4) = Null AS SET @Voyage_Start = IsNull(@Voyage_Start, '%') SET @Voyage_End = IsNull(@Voyage_End, '%') SET @Sales_Rep = IsNull(@Sales_Rep, '%') SET @Service = IsNull(@Service, '%') -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements
Words: 356 - Pages: 2
#include #include typedef struct Node { int data; struct Node *next; }node; void insert(node *pointer, int data) { /* Iterate through the list till we encounter the last node.*/ while(pointer->next!=NULL) { pointer = pointer -> next; } /* Allocate memory for the new node and put data in it.*/ pointer->next = (node *)malloc(sizeof(node)); pointer = pointer->next;
Words: 546 - Pages: 3
1. | What does SQL stand for? | | Structured Query Language | | Structured Question Language | | Strong Question Language | | | 2. | Which SQL statement is used to extract data from a database? | | OPEN | | EXTRACT | | GET | | SELECT | 3. | Which SQL statement is used to update data in a database? | | SAVE AS | | UPDATE | | SAVE | | MODIFY | 4. | Which SQL statement is used to delete data from a database? | | DELETE | | REMOVE |
Words: 461 - Pages: 2
Assignment 2 Task 1 OrderItem Items Orders Reps Customers Has many Can be ordered Can place Can contain Can be stored ItemLocation WarehouseLocations Can store Domain Name | Meaning | Domain Definition | ID | Representative Number, Customer Number, Order Number, Item Number, Warehouse Number | Alphanumeric Size 10 | Name | Customer
Words: 2823 - Pages: 12
criterion. 3. What are data types and why are they important? A data type is a classification identifying one of various types of data, they are important because assigning data types gives meaning to collections of information 4. Provide an example of the GROUP by clause, when would you use this clause? SELECT Salesperson, SUM(Revenue) AS ‘Total’, MIN(Revenue) AS ‘Smallest’, MAX(Revenue) AS ‘Largest’, AVG(Revenue) AS ‘Average’, COUNT(Revenue) AS ‘Number’ FROM Orders GROUP BY Salesperson
Words: 318 - Pages: 2