<!DOCTYPE html> <html> <head> <title>Hello, World!</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <div id="main-splitpane-left" class="coding-question__left-pane"><section class="question-view__title-wrapper"><h1 class="disable-text-selection question-view__title">12. SQL: Outdoor Banner Digital Marketplace Customer Report</h1></section><section class="question-view__instruction"><div class="candidate-rich-text disable-text-selection"><div id="b3b0eestsbs-instruction"><style type="text/css">.ps-content-wrapper-v0 div { margin: 0 auto; overflow: auto; } .ps-content-wrapper-v0 div.preheader { display: none; } .ps-content-wrapper-v0 p { white-space: pre-wrap; padding-left: 4px; padding-right: 4px; padding-top: 0px; padding-bottom: 2px; } .ps-content-wrapper-v0 p.section-title { font-weight: bold; padding-bottom: 0px; } .ps-content-wrapper-v0 ol.plain-list, .ps-content-wrapper-v0 ul.plain-list { list-style-type: none; padding: 4px; } .ps-content-wrapper-v0 li { white-space: normal; margin-top: 4px; margin-bottom: 4px; } .ps-content-wrapper-v0 code { color: black; } .ps-content-wrapper-v0 pre { background-color: #f4faff; border: 0; border-radius: 2px; margin: 8px; padding: 10px; } .ps-content-wrapper-v0 pre.scrollable-full-json { overflow-x: scroll; white-space: pre; } .ps-content-wrapper-v0 pre.scrollable-json { height: 300px; overflow-y: scroll; display: inline-grid; white-space: pre-wrap; padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; } .ps-content-wrapper-v0 div.equation-parent { width: 400px; text-align: center; border: 1px solid #000; padding: 8px; } .ps-content-wrapper-v0 div.equation-parent.equation { width: 100%; display: inline-block; } .ps-content-wrapper-v0 figure { background-color: transparent; display: table; margin-top: 8px; margin-bottom: 8px; text-align: center; margin-left: auto; margin-right: auto; } .ps-content-wrapper-v0 figcaption { text-align: center; display: table-caption; caption-side: bottom; margin-top: 4px; margin-bottom: 4px; } .ps-content-wrapper-v0 img { width: auto; max-width: 100%; height: auto; } .ps-content-wrapper-v0 details { background-color: transparent; padding-left: 4px; padding-right: 4px; padding-top: 0px; padding-bottom: 2px; } .ps-content-wrapper-v0 details details { padding-left: 8px; padding-right: 8px; } .ps-content-wrapper-v0 details summary { background-color: #39424e; color: white; font-weight: bold; margin-top: 4px; margin-bottom: 4px; padding: 8px; } .ps-content-wrapper-v0 details details summary code { color: black; font-weight: bold; padding-left: 2px; padding-right: 2px; padding-top: 4px; padding-right: 4px; margin-left: 4px; } .ps-content-wrapper-v0 details div.collapsable-details { margin: 0 auto; padding-left: 4px; padding-right: 4px; padding-top: 0px; padding-bottom: 2px; overflow: auto; } .ps-content-wrapper-v0 details div.collapsable-details pre { margin-left: 4px; margin-right: 4px; margin-top: 4px; margin-bottom: 4px; } .ps-content-wrapper-v0 table.normal { border: 1px solid black; border-collapse: collapse; border-color: darkgray; margin: 0 auto; margin-top: 8px; margin-bottom: 8px; padding: 8px; width: 96%; table-layout: fixed; } .ps-content-wrapper-v0 table.normal tbody { display: block; overflow-x: auto; overflow-y: hidden; } .ps-content-wrapper-v0 table.normal tbody tr:first-child th { font-weight: bold; white-space: normal; } .ps-content-wrapper-v0 table.normal tbody tr th, .ps-content-wrapper-v0 table.normal tbody tr td { font-weight: normal; white-space: nowrap; text-align: center; vertical-align: middle; border: 1px solid black; border-color: darkgray; padding: 8px; } .ps-content-wrapper-v0 table.database-table { border-collapse: collapse; border-color: darkgray; border: 1px solid black; width: auto; margin-left: 4px; margin-top: 8px; margin-bottom: 8px; padding: 8px; } .ps-content-wrapper-v0 table.database-table tbody { overflow-x: auto; overflow-y: hidden; border: none; } .ps-content-wrapper-v0 table.database-table tbody tr th, .ps-content-wrapper-v0 table.database-table tbody tr td { font-weight: normal; white-space: nowrap; text-align: center; vertical-align: middle; border: 1px solid black; border-color: darkgray; padding: 8px; } .ps-content-wrapper-v0 table.database-table tbody tr th { font-weight: bold; border: 1px solid black; } .ps-content-wrapper-v0 table.database-table tbody tr:nth-child(2) td { border: 1px solid black; } .ps-content-wrapper-v0 table.database-table tbody tr:nth-child(n+2) td:first-child { border-left-color: black; } .ps-content-wrapper-v0 table.database-table tbody tr:nth-child(n+2) td:last-child { border-right-color: black; } .ps-content-wrapper-v0 table.database-table tbody tr:last-child td { border-bottom-color: black; } .ps-content-wrapper-v0 table.database-table tbody tr td.description { text-align: left; white-space: pre-wrap; } .ps-content-wrapper-v0 table.normal tbody tr th.description { width: 60%; } .ps-content-wrapper-v0 table.function-params tbody tr:first-child td.headers { border-bottom-width: 2px; } .ps-content-wrapper-v0 table.function-params tbody tr:last-child td { border-top-width: 2px; border-top-color: darkgray; } .ps-content-wrapper-v0 table.function-params tbody tr td.headers { width: 25%; font-weight: bold; text-align: center; border: 1px solid black; border-right-width: 2px; border-color: darkgray; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell { width: 100%; height: 100%; padding: 0px; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table { width: 100%; height: 100%; padding: 0px; margin: 0px; border: 0; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr td.code { white-space: normal; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr th { border-top: 0; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr th:first-child { border-left: 0; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr th:last-child { border-right: 0; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr:last-child td { border-bottom: 0; border-top-width: 1px; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr td:first-child { border-left: 0; } .ps-content-wrapper-v0 table.function-params tbody tr td.params-table-cell table.params-table tbody tr td:last-child { border-right: 0; } .ps-content-wrapper-v0 table.sudoku { border-collapse: collapse; border-color: darkgray; margin: 0 auto; margin-top: 8px; margin-bottom: 8px; padding: 8px; } .ps-content-wrapper-v0 table.sudoku colgroup, tbody { border: 3px solid black; } .ps-content-wrapper-v0 table.sudoku td { border: 1px solid black; height: 25px; width: 25px; text-align: center; padding: 0; } .ps-content-wrapper-v0 .left { text-align: left; } .ps-content-wrapper-v0 .right { text-align: right; } .ps-content-wrapper-v0 .code { font-family: monospace; white-space: nowrap; } .ps-content-wrapper-v0 .json-object-array ol, .ps-content-wrapper-v0 .json-object-array ol ul { margin-top: 0px; padding-left: 14px; } .json-object-array li { float: left; margin-right: 30px; margin-left: 10px; } .json-object-array pre { padding: 4px; margin-left: 0px; } </style> <div class="ps-content-wrapper-v0"> <p dir="auto">In developing a digital marketplace for outdoor banners, a query is needed to return information about customers and the banners they have, including the total area and the total cost of renting those banners.</p> <p dir="auto"> </p> <p dir="auto">The result should have the following columns: <em>username | cities | banners | total_area | total_cost</em>.</p> <ul dir="auto"> <li> <em>username</em> - customer username</li> <li> <em>cities</em> - list of records of city names that have a banner of a specific customer: <ul dir="auto"> <li>The record is the city name</li> <li>Records are separated by a comma</li> <li>Records are sorted in descending order by banner cost</li> </ul> </li> <li> <em>banners</em> - total number of banners for a specific customer</li> <li> <em>total_area</em> - total banner area for a specific customer</li> <li> <em>total_cost</em> - total banner cost for a specific customer</li> </ul> <p dir="auto"> </p> <p dir="auto">The result should be sorted in ascending order by <em>username</em>.</p> <p dir="auto"> </p> <p dir="auto"><strong>Note:</strong></p> <ul dir="auto"> <li>The cost of a banner in a specific city can be calculated as <code>banner_area * banner_cost</code> </li> <li>Banners are rectangular</li> </ul> <p> </p> <details open=""><summary class="section-title">Schema</summary> <div class="collapsable-details"> <p> </p> <table class="database-table"> <tbody> <tr> <th colspan="4">cities</th> </tr> <tr> <th align="left">name</th> <th align="left">type</th> <th align="left">constraint</th> <th align="left">description</th> </tr> <tr> <td align="left">id</td> <td align="left">INT</td> <td align="left">PRIMARY KEY</td> <td align="left">City ID</td> </tr> <tr> <td align="left">name</td> <td align="left">VARCHAR(255)</td> <td align="left"> </td> <td align="left">City name</td> </tr> <tr> <td align="left">banner_cost</td> <td align="left">DECIMAL(5,2)</td> <td align="left"> </td> <td align="left">City banner cost (per square meter)</td> </tr> </tbody> </table> <p> </p> <table class="database-table"> <tbody> <tr> <th colspan="4">customers</th> </tr> <tr> <th align="left">name</th> <th align="left">type</th> <th align="left">constraint</th> <th align="left">description</th> </tr> <tr> <td align="left">id</td> <td align="left">INT</td> <td align="left">PRIMARY KEY</td> <td align="left">Customer ID</td> </tr> <tr> <td align="left">username</td> <td align="left">VARCHAR(255)</td> <td align="left"> </td> <td align="left">Customer username</td> </tr> </tbody> </table> <p> </p> <table class="database-table"> <tbody> <tr> <th colspan="4">banners</th> </tr> <tr> <th align="left">name</th> <th align="left">type</th> <th align="left">constraint</th> <th align="left">description</th> </tr> <tr> <td align="left">city_id</td> <td align="left">INT</td> <td align="left">FOREIGN KEY (city_id => cities.id)</td> <td align="left">City ID</td> </tr> <tr> <td align="left">customer_id</td> <td align="left">INT</td> <td align="left">FOREIGN KEY (customer_id => customers.id)</td> <td align="left">Customer ID</td> </tr> <tr> <td align="left">width</td> <td align="left">SMALLINT</td> <td align="left"> </td> <td align="left">Banner width</td> </tr> <tr> <td align="left">height</td> <td align="left">SMALLINT</td> <td align="left"> </td> <td align="left">Banner height</td> </tr> </tbody> </table> <p> </p> </div> </details> <details open=""><summary class="section-title">Sample Data Tables</summary> <div class="collapsable-details"> <p> </p> <table class="database-table" style="font-size:16px;"> <tbody> <tr> <th colspan="3">cities</th> </tr> <tr> <th align="left">id</th> <th align="left">name</th> <th align="left">banner_cost</th> </tr> <tr> <td align="left">1</td> <td align="left">Nouaseur</td> <td align="left">78.53</td> </tr> <tr> <td align="left">2</td> <td align="left">Al awtah</td> <td align="left">39.85</td> </tr> <tr> <td align="left">3</td> <td align="left">Modice</td> <td align="left">14.44</td> </tr> </tbody> </table> <p> </p> <table class="database-table" style="font-size:16px;"> <tbody> <tr> <th colspan="2">customers</th> </tr> <tr> <th align="left">id</th> <th align="left">username</th> </tr> <tr> <td align="left">1</td> <td align="left">daubray0</td> </tr> <tr> <td align="left">2</td> <td align="left">pstlouis1</td> </tr> </tbody> </table> <p> </p> <table class="database-table" style="font-size:16px;"> <tbody> <tr> <th colspan="4">banners</th> </tr> <tr> <th align="left">city_id</th> <th align="left">customer_id</th> <th align="left">width</th> <th align="left">height</th> </tr> <tr> <td align="left">1</td> <td align="left">1</td> <td align="left">7</td> <td align="left">19</td> </tr> <tr> <td align="left">1</td> <td align="left">1</td> <td align="left">9</td> <td align="left">12</td> </tr> <tr> <td align="left">1</td> <td align="left">1</td> <td align="left">10</td> <td align="left">14</td> </tr> <tr> <td align="left">1</td> <td align="left">1</td> <td align="left">17</td> <td align="left">6</td> </tr> <tr> <td align="left">1</td> <td align="left">2</td> <td align="left">8</td> <td align="left">11</td> </tr> <tr> <td align="left">1</td> <td align="left">2</td> <td align="left">19</td> <td align="left">10</td> </tr> <tr> <td align="left">2</td> <td align="left">1</td> <td align="left">16</td> <td align="left">5</td> </tr> <tr> <td align="left">2</td> <td align="left">1</td> <td align="left">16</td> <td align="left">8</td> </tr> <tr> <td align="left">3</td> <td align="left">1</td> <td align="left">7</td> <td align="left">9</td> </tr> <tr> <td align="left">3</td> <td align="left">1</td> <td align="left">8</td> <td align="left">16</td> </tr> <tr> <td align="left">3</td> <td align="left">1</td> <td align="left">11</td> <td align="left">14</td> </tr> <tr> <td align="left">3</td> <td align="left">1</td> <td align="left">13</td> <td align="left">10</td> </tr> <tr> <td align="left">3</td> <td align="left">1</td> <td align="left">17</td> <td align="left">16</td> </tr> <tr> <td align="left">3</td> <td align="left">1</td> <td align="left">18</td> <td align="left">11</td> </tr> <tr> <td align="left">3</td> <td align="left">2</td> <td align="left">5</td> <td align="left">13</td> </tr> <tr> <td align="left">3</td> <td align="left">2</td> <td align="left">6</td> <td align="left">13</td> </tr> <tr> <td align="left">3</td> <td align="left">2</td> <td align="left">15</td> <td align="left">5</td> </tr> <tr> <td align="left">3</td> <td align="left">2</td> <td align="left">16</td> <td align="left">12</td> </tr> <tr> <td align="left">3</td> <td align="left">2</td> <td align="left">17</td> <td align="left">19</td> </tr> <tr> <td align="left">3</td> <td align="left">2</td> <td align="left">20</td> <td align="left">13</td> </tr> </tbody> </table> <p> </p> </div> </details> <details open=""><summary class="section-title">Expected Output</summary> <div class="collapsable-details"> <p> </p> <table class="database-table"> <tbody> <tr> <th align="left">username</th> <th align="left">cities</th> <th align="left">banners</th> <th align="left">total_area</th> <th align="left">total_cost</th> </tr> <tr> <td align="left">daubray0</td> <td align="left">Nouaseur,Al awtah,Modice</td> <td align="left">12</td> <td align="left">1636</td> <td align="left">59864.59</td> </tr> <tr> <td align="left">pstlouis1</td> <td align="left">Nouaseur,Modice</td> <td align="left">8</td> <td align="left">1271</td> <td align="left">36170.26</td> </tr> </tbody> </table> </div> </details> </div> </div></div></section></div> <script src="script.js"></script> </body> </html>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>