Active backlogs there is a database with two tables relating to students at a school.

Write, Run & Share MySQL queries online using OneCompiler's MySQL online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for MySQL. Getting started with the OneCompiler's MySQL editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose language as 'MySQL' and start writing queries to learn and test online without worrying about tedious process of installation.

About MySQL

MySQL is a open-source, free and very popular relational database management system which is developed, distributed and supported by Oracle corporation.

Key Features:

  • Open-source relational database management systems.
  • Reliable, very fast and easy to use database server.
  • Works on client-server model.
  • Highly Secure and Scalable
  • High Performance
  • High productivity as it uses stored procedures, triggers, views to write a highly productive code.
  • Supports large databases efficiently.
  • Supports many operating systems like Linux*,CentOS*, Solaris*,Ubuntu*,Windows*, MacOS*,FreeBSD* and others.

Syntax help

CREATE TABLE table_name ( column1 datatype, column2 datatype, ....);CREATE TABLE EMPLOYEE ( empId INTEGER PRIMARY KEY, name TEXT NOT NULL, dept TEXT NOT NULL );ALTER TABLE Table_name ADD column_name datatype;INSERT INTO EMPLOYEE VALUES (0001, 'Dave', 'Sales');TRUNCATE table table_name;DROP TABLE table_name;RENAME TABLE table_name1 to new_table_name1; --Line1; /* Line1, Line2 */INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);

Note: Column names are optional.

Example

INSERT INTO EMPLOYEE VALUES (0001, 'Ava', 'Sales');

2. SELECT

SELECT column1, column2, ... FROM table_name [where condition];

Example

SELECT * FROM EMPLOYEE where dept ='sales';

3. UPDATE

UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;

Example

UPDATE EMPLOYEE SET dept = 'Sales' WHERE empId='0001';

4. DELETE

DELETE FROM table_name where condition;

Example

DELETE from EMPLOYEE where empId='0001';

Indexes

1. CREATE INDEX

CREATE INDEX index_name on table_name(column_name); CREATE UNIQUE INDEX index_name on table_name(column_name);

2. DROP INDEX

DROP INDEX index_name ON table_name;

Views

1. Create a View

Creating a View: CREATE VIEW View_name AS Query;

2. How to call view

SELECT * FROM View_name;

3. Altering a View

ALTER View View_name AS Query;

4. Deleting a View

DROP VIEW View_name;

Triggers

1. Create a Trigger

CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name FOR EACH ROW [trigger_order] trigger_body /* where trigger_time: { BEFORE | AFTER } trigger_event: { INSERT | UPDATE | DELETE } trigger_order: { FOLLOWS | PRECEDES } */

2. Drop a Trigger

DROP TRIGGER [IF EXISTS] trigger_name;

Stored Procedures

1. Create a Stored Procedure

CREATE PROCEDURE sp_name(p1 datatype) BEGIN /*Stored procedure code*/ END;

2. How to call Stored procedure

CALL sp_name;

3. How to delete stored procedure

DROP PROCEDURE sp_name;

Joins

1. INNER JOIN

SELECT * FROM TABLE1 INNER JOIN TABLE2 where condition;

2. LEFT JOIN

SELECT * FROM TABLE1 LEFT JOIN TABLE2 ON condition;

3. RIGHT JOIN

SELECT * FROM TABLE1 RIGHT JOIN TABLE2 ON condition;

4. CROSS JOIN

SELECT select_list from TABLE1 CROSS JOIN TABLE2;

This is a database with two tables relating to students at a school. Each student has a unique ID. There is a backlog table that

maintains a record of active backlogs for each student.

Write a query my oracle sql to print the names of the students who have at least one active backlog. The names shoule be printed in ascending order.The results should be in the following format:

NAME

Note: There could be students with the same name but they would
have different IDs.

Schema

Student Table

Name Type Description
ID INteger This

Active backlogs there is a database with two tables relating to students at a school.

Mechanical Electrical Engineering Civil Engineering Chemical Engineering Electronics and Communication Engineering Mathematics Physics Chemistry Software Works/ Computer Science Other Subjects

Expert Tutors 100% Correct Solutions 24/7 Availability One stop destination for all subject Cost Effective Solved on Time Plagiarism Free Solutions Confidentiality

This MySQL question (depicted in these pics I found online) showed up on an interview and I can't figure out why my query didn't pass. Just trying to figure out what was incorrect about it.

My query was as follows:

I also tried a left join and checked where SUBJECT_ID wasn't null or empty, which didn't work either. The question seems pretty straightforward - return the names of students who have an existing entry in the backlog table for their ID. I appreciate any constructive feedback!

Active backlogs there is a database with two tables relating to students at a school.

Sorry, this post was removed by Reddit's Legal Operations team.

This content was removed in response to a copyright claim by a third party.

9 comments

Active backlogs there is a database with two tables relating to students at a school.

Philip J.

Intro Stats / AP Statistics 4 months, 1 week ago

2. Active Backlogs There is a database with two tables relating to students at a school. Each student has a unique ID. There is a backlog table that maintains a record of active backlogs for each student: Write a query to print - the names of the students who have at least one active backlog: The names should be printed in ascending order: The result should be in the following format: NAME Note: There may be students with the same name but with different IDs.

Active backlogs there is a database with two tables relating to students at a school.

This browser does not support the video element.

Given a relation S(student, subject, marks), write a query to find the top 10 students by total marks, by using SQL ranking. Include all students tied for the final spot in the ranking, even if that results in more than 10 total students.

Right so to day, we are going to be writing a query to find top 10 students, including students tied for the final spot. Even if that results in more than 10 students. Now i'm just going to be using post grass because it wasn't specified which flavour of of a sequel that i should use, so i'm just going to use to open so as 1 and even though the question says using as using sequal ranking. I believe this is a bit ambiguous here because, as you'll see in a second, there are actually 2 types of ranking in sequel. So, let's just start, i'm sure you can agree that this is the table s or what i've assumed it to be. We have a student, a subject and marks right, and i've created a bunch of students which you can see here. I have created an bob charles and darin, with different scores. Bob and charles are tied for the same total marks, even though they have different marks in each subject and darn has a perfect 5050 and is going to be our a star student. So, even though the question asked to rank the top 10, i believe i can demonstrate the same point just by creating 4 students and ranking the top 3 right. So let's explore the query here. So those are just the incert statements. You don't have to worry about that. I printed the entire table out for you to see, and so the answer here is going to use a sub query. If you are not sure of what a sub query is it's basically where you have to create a smaller query and then run another query on that right, so i've chosen to go with this syntax, which is called a common table expression, meaning this inner table here. Select student baba is going to be henceforth known as student ranking, which is using the final query here right. So let's go over this. We select student and we're going to some marks grouped by students right so for each student. We'Re going to sum the marks over all their subjects and call that total marks right. Similarly, we are going to rank them over that sum of total marks in a descending order, as student rank right. So i'm going to i'm going to demonstrate here why rank is not appropriate for what we want here. As you can see, i'm going to run 1 more query on the result of that and i'm going to select everything from student ranking where student rank is less than equal to 3 right. And you can see here that, even though we know that charles and bob are tied for number 2 right and that and that darrin did technically tie did technically qualify to be in this list. As the third highest ranking student is not shown here, because we are using rank right now, let me fix that by changing this, to dense rank sorry, and we will see how that helps us out right, as we can see now. Daring now correctly shows up as number 3, but why is that? The case? Because when you use normal just to function, rank right? Darren'S rank was number 4 because we had 2 students who jointly ranked number 2 and therefore, if you use normal rank, the numbering continues at number 4 because you had n number 1, charles and bobbin at joint number, 2 and therefore 3. And then it continually continues. The numbering it 4 using dense rank forces sequal to use the next contiguous number to continue that ranking. Therefore, darn will have a rank of 3, even though there were people who tight for number 2 before him, and i believe that is more in line with the requirement that was data in the question right. So i'm leaving the query here on screen for you. If you want, you can post the video and have a look at it.

Upgrade today to get a personal Numerade Expert Educator answer!

  • Ask unlimited questions
  • Test yourself
  • Join Study Groups
  • Create your own study plan
  • Join live cram sessions
  • Live student success coach
Try it free for 7 days Try it free for 30 days
Active backlogs there is a database with two tables relating to students at a school.

Srikar K.
Temple University

Active backlogs there is a database with two tables relating to students at a school.

Catherine R.
Missouri State University

Active backlogs there is a database with two tables relating to students at a school.

Boris M.
University of North Carolina at Chapel Hill

Megan C.
Piedmont College

Active backlogs there is a database with two tables relating to students at a school.

Christine G.
Cairn University

Active backlogs there is a database with two tables relating to students at a school.

Monique R.
Numerade Educator

Active backlogs there is a database with two tables relating to students at a school.

Heather Z.
Oregon State University

Active backlogs there is a database with two tables relating to students at a school.

Lucas E.
University of St. Thomas

Active backlogs there is a database with two tables relating to students at a school.

Michael J.
Idaho State University

Active backlogs there is a database with two tables relating to students at a school.

Joseph L.
Boston College

Data And Variables

Data And Variables - Example 1


Join Course

3. Decompose the following re…

Write a program to enter the …


About

Our Story Careers Our Educators Numerade Blog

Browse

Courses Books Topics Test Prep Ask Directory

Support

Help Privacy Policy Terms of Service

Get Started

Sign Up Log in