Database Quizz I Write down your answers in word document with file name highlighting your name, student number, and class. E.g “95002”+”_”+ “03 class”+”_”+”name”,

Slides:



Advertisements
Similar presentations
Chapter 8 Special-Purpose Languages. SQL SQL stands for "Structured Query Language". Allows the user to pose complex questions of a database. It also.
Advertisements

SQL Neyha Amar CS 157A, Fall Inserting The insert statement is used to add a row of data into a table Strings should be enclosed in single quotes,
Inclass Test Revision Database Technology Level I Lecture and Seminar Revision.
Structured Query Language Introduction to SQL What is SQL? – –When a user wants to get some information from a database file, he can issue a query.1.
Agenda Journalling More Embedded SQL. Journalling.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
Data Manipulation 11 After this lecture, you should be able to:  Understand the differences between SQL (Structured Query Language) and other programming.
MS Access Database Connection. Database? A database is a program that stores data and records in a structured and queryable format. The tools that are.
CIS 103 — Applied Computer Technology Last Edited: September 17, 2010 by C.Herbert Using Database Management Systems.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Relational Databases (MS Access)
1 What is database 2? What is normalization? What is SQL? What is transaction?
1 TAC2000/ Protocol Engineering and Application Research Laboratory (PEARL) Structured Query Language Introduction to SQL Structured Query Language.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
CSE 154 LECTURE 14: MULTI-TABLE SQL QUERIES (JOINS)
CS 1308 Computer Literacy and the Internet
Relational Algebra CS420. Relation A relation is a two dimensional table that Rows contain data about an entity Columns contains data about attributes.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 5 © Akhilesh Bajaj, 2000, 2002, 2003, All.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
What have we learned?. What is a database? An organized collection of related data.
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
Database revision.
Chapter 8 Database Redesign We only discuss complex sub-queries.
WXGE 6101 DATABASE CONCEPTS & IMPLEMENTATIONS. Lesson Overview The Relational Model Terminology of relational model. Properties of database relations.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
CMPT 258 Database Systems The Relationship Model (Chapter 3)
JOHN DOE PERIOD 8. AT LEAST 80% OF HUMANITY LIVES ON LESS THAN $10 A DAY.
1 SQL – IV Grouping data from tables in SQL –The concept of grouping –GROUP BY clause –HAVING Clause –Determining whether values are unique –Group by using.
1 SY306 Web and Databases for Cyber Operations Set #13: SQL SELECT Grouping and sub-queries.
There are two types of MySQL instructions (Data Definition Language) DDL: Create database, create table, alter table,,,. (Data Manipulation Language) DML.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 4 © Akhilesh Bajaj, 2000, 2002, 2004, All.
April 2002 Information Systems Design John Ogden & John Wordsworth 1 Database Design SQL (1) John Wordsworth Department of Computer Science The University.
Database to HTML and Back again A programmers tale.
SQL BY MR.PRASAD SAWANT INDIA Introduction to SQL What is SQL? –When a user wants to get some information from a database file, he can issue a query.1.
Chapter 7 SQL HUANG XUEHUA. SQL Select-From-Where Statements SELECT desired attributes FROM one or more tables WHERE condition about tuples of the tables;
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
BR SQL SUPPORT I have a legacy application and I don’t intend to rewrite it any time soon. Why should I be concerned with this?
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
SQL LANGUAGE TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Select Complex Queries Database Management Fundamentals LESSON 3.1b.
1 数据库系统概论 An Introduction to Database System 第三章 关系数据库标准语言 SQL ( 续 2 )
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
Query Methods Simple SQL Statements Start ….
CS422 Principles of Database Systems Course Overview
Constraints and Triggers
The Database Exercises Fall, 2009.
Databases and Information Management
MS Access Database Connection
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Structured Query Language
Databases: An Introduction
Advanced SQL: Views & Triggers
SQL.
CMPT 354: Database System I
Database Design and Development
Databases and Information Management
Database Design and Development

Database Assignment Write down your answers in word document with file name highlighting your name, student number, and class. E.g “95002”+”_”+ “03 class”+”_”+”name”,
Updating Databases With Open SQL
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
Database SQL.
Manipulating Data Lesson 3.
SQL Tutorial Basic SQL Commands
Updating Databases With Open SQL
Programming Techniques
Database Including Questions and Standard Answers TEACHER Database Including Questions and Standard Answers Examinee Scoring.
Presentation transcript:

Database Quizz I Write down your answers in word document with file name highlighting your name, student number, and class. E.g “95002”+”_”+ “03 class”+”_”+”name”, like, “95002_03_Mike.doc”

Number 1(20%) Use one SQL statement to get the list of all the student names, whose every registered course has a score higher than 85. name  course  score Mike  DataBase   81 Jane  DataBase   86 Jane  Math    90 Tonny DataBase   86 Tonny  Math   100   A. select distinct name from SC  where name not in (select distinct name from SC where score<=85)

Number 2 (20%) Assume the student table has the following rows. Serial Number Sno Sname Cno Cname Score 1     2005001 Mike 0001   Math  99 2     2005002 John 0001   Math  89 3     2005001 Mike 0001   Math  99 Use one SQL statement to delete the records whose attributes are redundant except for Serial number. A. delete from tablename where seriel Number not in (select min(serial Number) from tablename group by Sno, Sname, Cname, Score)

Number 3(30%) Assume a database has the following tables. Teacher(Tno, Tname) describes the information concerning teachers Student(Sno,Sname,Sage,Ssex) stores the information about students Course(Cno,Cname,Tno) is the course table SC(Sno,Cno,score) has the scores 1. Use one SQL statement to get the list of student names, who at least registers one common course with student with Sno “95005” A. select distinct SC.Sno,Sname from Student,SC where Student.Sno=SC.Sno and Cno in (select Cno from SC where Sno=‘95005') 2. Use one SQL statement to get the complete list of students, who registers only one course. Print their student numbers and names and order the list by student number. A. select SC.Sno,Student.Sname,count(Cno) from SC ,Student where SC.Sno=Student.Sno group by SC.Sno ,Student.Sname having count(Cno)=1  

3. Use one SQL statement to get the list of courses, each of which is registered by every student.   A. select Cno, Cname  from Course  where Cno in  (select Cno from SC group by Cno having count(*) = (select count(*) from student))