Question

Write SQL queries to answer the following question: A. Which students are enrolled in Database and...

Write SQL queries to answer the following question: A. Which students are enrolled in Database and Networking? (Hint: use SectionNo for each class, so that you can determine the answer from the Registration table by itself.)

I have attempted the code below, but am receiving an error under the first SELECT, showing error code 1064, (syntax error)

SELECT StudentName, StudentID FROM Student

WHERE StudentID =(select StudentID FROM Registration

WHERE (SectionNo=2714 OR SectionNo=2715)

GROUP BY StudentID

HAVING COUNT (*)>1;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since you have not provided the db schema, i am providing the query by guessing the table and column names. Hence, the query might need some suggestions in order to run properly.

QUERY:

SELECT StudentName, StudentID FROM Student s JOIN Registration r ON s.StudentID = r.StudentID

WHERE r.SectionNo IN(2714, 2715);

Add a comment
Know the answer?
Add Answer to:
Write SQL queries to answer the following question: A. Which students are enrolled in Database and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem 1-5 using the table below in the picture to be answered in Microsoft SQL. Thanks...

    Problem 1-5 using the table below in the picture to be answered in Microsoft SQL. Thanks 4. Write SQL queries to answer the following questions, a. How many students were enrolled in secoon 14 b. How many students were enrolled in ISM 3113 5. Write an SOL query to answer the following question Which students were not enrolled in any courses on Problems and Exercises 6 through 14 are based on Figure 7-15. The problem set continues from Chapter 6,...

  • Subject : computer science -web development Qus: using the database tables below write the SQL queries:...

    Subject : computer science -web development Qus: using the database tables below write the SQL queries: ( SELECT; FORM; WHERE; ORDER BY; DISTINCT; GROUP BY; COUNT(); SUM(); AVG(); MAX(); MIN(); JOIN; ON) Student (StudentId, Major, GPA) Transcript( Studentid, CourseNo, Gread); Course( CourseNo, Title, Credits) Display the title of the course(s) that are 3 credits? Display the average GPA of the students Majoring in ‘CSC’ List non duplicated major(s) of students who have received a grades of ‘A’ in CSC350 List...

  • 4. Write SQL data definition commands for each of the following queries: a. How would you add an attribute, Class, to the Student table? b. How would you remove the Registration table? c. How would you change the FacultyName field from 25 characters

    Problems and Exercises 1 through 9 are based on the dass scheduling 3NF relations along with some sample data shown in Figure 6-11. Not shown in this figure are data for an ASSIGNMENT relation, which represents a many-to-many relationship between faculty and sections.4. Write SQL data definition commands for each of the following queries:a. How would you add an attribute, Class, to the Student table?b. How would you remove the Registration table?c. How would you change the FacultyName field from...

  • You will need to refer to the University database to answer this question. Write SQL queries...

    You will need to refer to the University database to answer this question. Write SQL queries to perform the following operations. each case show the SQL statement you used and the output from MySQL. You are required to include screenshots showing the actu output of your queries. The tables of University database are as follows: region (region_number, address, telephone, email _address) staff (staff number, name, address, email_address, telephone,

  • Consider the following database and answer the questions below. a) Write the SQL statement the displays...

    Consider the following database and answer the questions below. a) Write the SQL statement the displays the names of the students who have enrolled in the Database Systems course b) Write the SQL statement that displays a list of the students whose names start with 'S' c) Write the SQL statement that displays the Student ID, Student Name, Course ID, and Grade for students that passed at least one course with a grade better than B+ (i.e. A-, A, and...

  • Given the following relational schema, write queries in SQL to answer the English questions. There is...

    Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...

  • Consider a database with the following schema. Return SQL code for the following queries.

    Consider a database with the following schema.BARS(name,license,city,phone,addr);BEERS(name,manf);DRINKERS(name,city,phone,addr);LIKES(drinker,beer); FREQUENTS(drinker,bar); SELLS(bar,beer,price); Return SQL code for the following queries.1.  Find all distinct drinkers whose phone numbers come from area code 917 and who like Budweiser or Bud (synonim!)2. What beers does Mike like?3. Which town has the most drinkers?4. What bars are frequented by drinkers from that town (3)?5. Provide all bars which serve beers that Mike likes6. Who likes the at least one same beer that Joe or Mike like?7.  All bars...

  • You must use the Access database and create queries that will answer the requests below. You...

    You must use the Access database and create queries that will answer the requests below. You may use direct SQL to create the queries. Store them using the number of the question (Q1, Q2, etc.). Question: Obtain the average price before discount of all books that were delivered after May 5, 2016. We're not using Join or Join In functions. Just SELECT, FROM, WHERE, ORDER BY, and SORT BY Thanks! Book Wrote Author Authorid AuthornD FrstName nitials Category AuthorRank OrderLine...

  • In using a database created from this model, which of the following SQL queries would give...

    In using a database created from this model, which of the following SQL queries would give us a list of customers who have daily deposit transactions (deposit is a transaction type) totaling $10,000 or more across all of their accounts (i.e., this is a total across all accounts of a customer, not per account). Include in this list the Customer ID and name, and the dates and their respective daily total. SELECT c.cust_id, c.cust_name, DATE(t.tran_date), SUM(t.tran_amount) AS daily_total FROM Customers...

  • K3 K3 School of CS & IT, RMIT Introduction to Database Systems Tutorial Sheet 2: SQL...

    K3 K3 School of CS & IT, RMIT Introduction to Database Systems Tutorial Sheet 2: SQL The database below is for a department store, and describes stock, staff, clients, and sales. Each question in this tutorial concerns this "store" database. SALE ITEM ITEM STAFF NUMSOLD CLIENT SDATE TYPE DESCRIP PRICE K3 Simon 6 Clark 19980311 Knife set $17.95 K11 Simon Cilla 19980121 K5 Ladle $6.95 K11 Simon Cilla 19980123 K11 Scraper $0.95 L12 Sorcha 5 Charles 19971130 L12 Rack $22.95...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT