Snippets Collections
# Dictionary View Objects
# keys() , values() & items() are called Dictionary Views as they provide a dynamic view on the dictionary’s items.

# Code
dict_a = {
    'name': 'Teja',
    'age': 15 
}
view = dict_a.keys()
print(view)
dict_a['roll_no'] = 10
print(view)


#output
# dict_keys(['name', 'age'])
# dict_keys(['name', 'age', 'roll_
dict_a = {
  'name': 'Teja',
  'age': 15
}
for key, value in dict_a.items():
    pair = "{} {}".format(key,value)
    print(pair)
GROUP BY AND HAVING CLAUSE

1.	Find the number of employees Department wise.

Ans : 

Select deptno, count(*) no_of_employees from employee group by deptno;

2.	Find the number of employees Job wise.

Ans : 

Select job, count(*) no_of_employees from employee group by job;


3.	Find the total salary distribution job wise in the year 1981. 

Ans : 

select job,sum(12*sal) from emp where to_char(hiredate,'YYYY') = '1981'
group by job ;


4.	Display the number of employees for each job group and department number wise. 

Ans : 

select d.deptno,e.job,count(e.job) from emp e,dept d where e.deptno(+)=d.deptno group by e.job,d.deptno;


5.	List the number of employees in each department where the number is more than 3. 

Ans : 

select deptno,count(*) from emp group by deptno  having count(*) > 3;


6.	List the names of departments where at least 3 are working in that department. 

Ans : 

select d.dname,count(*) from emp e ,dept d where e.deptno = d.deptno 
      group by d.dname 
                           having count(*) >= 3  ;





7.	List the department details where at least two employees are working 

Ans : 

select deptno ,count(*) from emp group by deptno 
       having count(*) >= 2;


8.	List the details of the department where maximum number of employees are working 

Ans : 

select * from dept where deptno in 
      (select deptno from emp group by deptno         
      having count(*) in 
      (select max(count(*)) from emp group by deptno) ); 
(OR) 

select d.deptno,d.dname,d.loc,count(*) from emp e ,dept d 
     where e.deptno = d.deptno group by d.deptno,d.dname,d..loc 
     having count(*) = (select max(count(*) ) from emp group by deptno);


9.	List the name of the department where more than average numbers of employees are working.

Ans : 

select d.dname from dept d, emp e where e.deptno = d.deptno 
group by d.dname 
having count(*) > (select avg(count(*)) from emp  group by deptno);

10.	List the manager name having maximum number of employees working under him.

Ans : 

select m.ename,count(*) from emp w, emp m 
where w.mgr = m.empno  
group by m.ename
having count(*) = (select max(count(*)) from emp group by mgr);      




11.	Check whether all the employee numbers are indeed unique.

Ans : 

select   empno,count(*)  from emp group by empno;

12.	Find all the employees who earn the minimum Salary for each job wise in ascending order. 

Ans : 

select * from emp where sal in 
     (select min(sal) from emp group by job) 
     order by sal asc;


13.	Find out all the employees who earn highest salary in each job type. Sort in descending salary order. 

Ans : 

select * from emp where sal in 
     (select max(sal) from emp group by job) 
     order by sal desc;


14.	Find out the most recently hired employees in each department order by joining date. 

Ans : 

select * from emp  e where hiredate in 
     (select max(hiredate) from emp where e.deptno =  deptno ) 
      order by hiredate;


15.	List the number of employees and Average salary within each department for each job 

Ans : 

select count(*),avg(sal),deptno,job from emp 
      group by deptno,job;


16.	Find the maximum average salary drawn for each job except for ‘President’. 

Ans : 

select max(avg(sal)) from emp  where job != 'PRESIDENT' group by job;


17.	List the department number and their average salaries for department with the average salary less than the averages for all departments.

Ans : 

select deptno,avg(sal) from emp group by deptno
having avg(sal) <(select avg(Sal) from emp);



<!DOCTYPE html>
<html>
<head>
  <title>أسماء المواضيع</title>
  <style>
    body {
      font-family: Arial, sans-serif;
    }
    .post-list {
      list-style-type: none;
      padding: 0;
    }
    .post-list li {
      margin: 5px 0;
    }
  </style>
</head>
<body>
  <h1>أسماء المواضيع</h1>
  <ul class="post-list" id="post-list"></ul>

  <script>
    function fetchPosts() {
      const blogId = 'blogId'; // استبدل YOUR_BLOG_ID بمعرف مدونتك
      const apiKey = 'apiKey'; // استبدل YOUR_API_KEY بمفتاح API الخاص بك

      const url = `https://www.googleapis.com/blogger/v3/blogs/${blogId}/posts?key=${apiKey}`;

      fetch(url)
        .then(response => response.json())
        .then(data => {
          const posts = data.items;
          const postList = document.getElementById('post-list');
          
          posts.forEach(post => {
            const listItem = document.createElement('li');
            const link = document.createElement('a');
            link.href = post.url;
            link.textContent = post.title;
            listItem.appendChild(link);
            postList.appendChild(listItem);
          });
        })
        .catch(error => console.error('Error fetching posts:', error));
    }

    document.addEventListener('DOMContentLoaded', fetchPosts);
  </script>
</body>
</html>
随机怎么生成
from pymongo import MongoClient, errors

# MongoDB connection settings
mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]

    # Define query to filter tweets related to KLM (tweets made by KLM or mentioning KLM)
    query = {
        "$or": [
            {"json_data.user.id": 56377143},  # Tweets made by KLM
            {"json_data.entities.user_mentions.id": 56377143}  # Tweets mentioning KLM
        ]
    }

    # Count the number of tweets related to KLM
    klm_tweet_count = source_collection.count_documents(query)

    print("Number of tweets related to KLM:", klm_tweet_count)

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
from pymongo import MongoClient, errors
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

# MongoDB connection settings
mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"

def get_text_from_doc(doc):
    """
    Extracts the text from the document.
    Returns the text if available, otherwise returns None.
    """
    text = doc.get("json_data", {}).get("text")
    if text:
        return text
    extended_text = doc.get("json_data", {}).get("extended_tweet", {}).get("full_text")
    return extended_text

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]

    cursor = source_collection.find().limit(20)  # Limit to only 20 tweets

    for doc in cursor:
        text = get_text_from_doc(doc)
        if text:
            print("Text:", text)
            print()

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
from pymongo import MongoClient, errors
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

# MongoDB connection settings
mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"

def get_text_from_doc(doc):
    """
    Extracts the text from the document.
    Returns the text if available, otherwise returns None.
    """
    text = doc.get("json_data", {}).get("text")
    if text:
        return text
    extended_text = doc.get("json_data", {}).get("extended_tweet", {}).get("full_text")
    return extended_text

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]

    cursor = source_collection.find()  # Limit to only 20 tweets

    for doc in cursor:
        text = get_text_from_doc(doc)
        if text:
            compound_score = analyze_sentiment(text)
            print("Compound Sentiment Score:", compound_score)
            print()

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
from pymongo import MongoClient, errors
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import re

# MongoDB connection settings
mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"

def get_text_from_doc(doc):
    """
    Extracts the text from the document.
    Returns the text if available, otherwise returns None.
    """
    text = doc.get("json_data", {}).get("text")
    if text:
        return text
    extended_text = doc.get("json_data", {}).get("extended_tweet", {}).get("full_text")
    return extended_text

def analyze_sentiment(text):
    """
    Analyzes the sentiment of the given text using VADER.
    Returns the compound sentiment score.
    """
    analyzer = SentimentIntensityAnalyzer()
    sentiment = analyzer.polarity_scores(text)
    return sentiment['compound']

def detect_irony(text):
    """
    Detects irony in the given text.
    Returns True if irony is detected, otherwise False.
    """
    irony_patterns = [
        r"\b(?:delay)\b.*\thanks\b",
        r"\b(?:can't|cannot)\b.*\bimagine\b",
        r"\bwhat a surprise\b",
        r"\bsarcasm\b",
        r"\birony\b",
        r"\bjust what I needed\b",
    ]

    for pattern in irony_patterns:
        if re.search(pattern, text, re.IGNORECASE):
            return True
    return False

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]

    cursor = source_collection.find().limit(20)  # Limit to only 20 tweets

    for doc in cursor:
        text = get_text_from_doc(doc)
        if text:
            compound_score = analyze_sentiment(text)
            irony_detected = detect_irony(text)
            print("Compound Sentiment Score:", compound_score)
            if irony_detected:
                print("Irony detected in text:", text)
            else:
                print("Text is not ironic.")
            print()

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
from pymongo import MongoClient, errors

mongo_uri = "mongodb://localhost:27017/"
database_name = "twitter_database"
source_collection_name = "tweets"
target_collection_name = "tweet_cleaned"

fields_to_extract = [
    "json_data.id",
    "json_data.user.id",
    "json_data.created_at",
    "json_data.text",
    "json_data.user.created_at",
    "json_data.in_reply_to_status_id",
    "json_data.in_reply_to_user_id",
    "json_data.user.description",
    "json_data.quoted_status_id",
    "json_data.extended_tweet.full_text",
    "json_data.entities.user_mentions.0.id",
    "json_data.entities.user_mentions.1.id",
    "json_data.entities.user_mentions.2.id",
    "json_data.lang",
    "json_data.entities.hashtags",
    "json_data.user.location",
    "json_data.is_quote_status",
]

def get_nested_field(data, field_path):
    keys = field_path.split('.')
    for key in keys:
        if isinstance(data, list):
            try:
                key = int(key)
                data = data[key]
            except (ValueError, IndexError):
                return None
        elif isinstance(data, dict):
            data = data.get(key)
        else:
            return None
        if data is None:
            return None
    return data

try:
    client = MongoClient(mongo_uri, serverSelectionTimeoutMS=5000)
    db = client[database_name]
    source_collection = db[source_collection_name]
    target_collection = db[target_collection_name]

    cursor = source_collection.find()

    for doc in cursor:
        lang = get_nested_field(doc, "json_data.lang")
        
        if lang in ["en", "nl", "es"]:
            new_doc = {field: get_nested_field(doc, field) for field in fields_to_extract}
            new_doc["_id"] = doc["_id"]
            
            # Insert the new document into the target collection
            target_collection.insert_one(new_doc)

    print("Data successfully transferred to new collections.")

except errors.ServerSelectionTimeoutError as err:
    print("Failed to connect to MongoDB server:", err)
except errors.PyMongoError as err:
    print("An error occurred while working with MongoDB:", err)
finally:
    client.close()
Private Sub btnUpdateCompanyName_Click()
    Dim accApp As Access.Application
    Dim strNewCompanyName As String
    Dim obj As AccessObject
    Dim ctl As Control
    Dim dbPath As String

    On Error GoTo ErrorHandler
    
    ' Get the new company name from the text box and handle Null value
    strNewCompanyName = Nz(Me.txtCompanyName.Value, "")

    ' Check if the text box is empty
    If Trim(strNewCompanyName) = "" Then
        MsgBox "Please enter the new company name.", vbExclamation
        Exit Sub
    End If

    ' Construct the relative path to the other database
    dbPath = CurrentProject.Path & "\Sales.accdb"

    ' Check if the other database is already open
    If IsDatabaseOpen(dbPath) Then
        MsgBox "The database is already open. Please close it before running this operation.", vbExclamation
        Exit Sub
    End If

    ' Open the other database
    Set accApp = New Access.Application
    accApp.OpenCurrentDatabase (dbPath)

    ' Loop through all forms
    For Each obj In accApp.CurrentProject.AllForms
        accApp.DoCmd.OpenForm obj.Name, acDesign
        For Each ctl In accApp.Forms(obj.Name).Controls
            If ctl.ControlType = acLabel And ctl.Name = "Label1" Then
                ctl.Caption = strNewCompanyName
            End If
        Next ctl
        accApp.DoCmd.Close acForm, obj.Name, acSaveYes
    Next obj

    ' Loop through all reports
    For Each obj In accApp.CurrentProject.AllReports
        accApp.DoCmd.OpenReport obj.Name, acViewDesign
        For Each ctl In accApp.Reports(obj.Name).Controls
            If ctl.ControlType = acLabel And ctl.Name = "Label1" Then
                ctl.Caption = strNewCompanyName
            End If
        Next ctl
        accApp.DoCmd.Close acReport, obj.Name, acSaveYes
    Next obj

    ' Close the other database
    accApp.CloseCurrentDatabase
    accApp.Quit
    Set accApp = Nothing

    ' Notify user
    MsgBox "Company name updated successfully!"

    Exit Sub

ErrorHandler:
    If Not accApp Is Nothing Then
        accApp.CloseCurrentDatabase
        accApp.Quit
        Set accApp = Nothing
    End If
    MsgBox "An error occurred: " & Err.Description, vbCritical

End Sub

The MIT License (MIT)

Copyright (c) 2020 Dean Attali

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
describe('DBM Smoketests', function() {
  it('E2E Hotel2 WorldPay System', function() {
    cy.visit('https://obmng.dbm.guestline.net/');
    cy.url().should('include','/obmng.dbm');

    Cypress.on('test:after:run', (test) => {
      addContext({ test }, { 
        title: 'This is my context title', 
        value: 'This is my context value'
      })
    });
  });
});
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
  Explore-GitHub-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v4
      - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."
Error: Not Found
The requested URL /favicon.ico was not found on this server.
#include<bits/stdc++.h>
using namespace std;
int fact(int n)
{
    int m=1;
    for(int i=1;i<=n;i++)
    {
        m=m*i;
    }
    return m;
}
int main()
{
    int n;
    cin>>n;
    cout<<"Factorial of number is: "<<fact(n);
    return 0;
}
Download Android Studio Jellyfish | 2023.3.1 Patch 1
Before downloading, you must agree to the following terms and conditions.

Terms and Conditions
This is the Android Software Development Kit License Agreement
1. Introduction
1.1 The Android Software Development Kit (referred to in the License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of the License Agreement. The License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK. 1.2 "Android" means the Android software stack for devices, as made available under the Android Open Source Project, which is located at the following URL: https://source.android.com/, as updated from time to time. 1.3 A "compatible implementation" means any Android device that (i) complies with the Android Compatibility Definition document, which can be found at the Android compatibility website (https://source.android.com/compatibility) and which may be updated from time to time; and (ii) successfully passes the Android Compatibility Test Suite (CTS). 1.4 "Google" means Google LLC, organized under the laws of the State of Delaware, USA, and operating under the laws of the USA with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA.
2. Accepting this License Agreement
2.1 In order to use the SDK, you must first agree to the License Agreement. You may not use the SDK if you do not accept the License Agreement. 2.2 By clicking to accept and/or using this SDK, you hereby agree to the terms of the License Agreement. 2.3 You may not use the SDK and may not accept the License Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries, including the country in which you are resident or from which you use the SDK. 2.4 If you are agreeing to be bound by the License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to the License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the SDK on behalf of your employer or other entity.
3. SDK License from Google
3.1 Subject to the terms of the License Agreement, Google grants you a limited, worldwide, royalty-free, non-assignable, non-exclusive, and non-sublicensable license to use the SDK solely to develop applications for compatible implementations of Android. 3.2 You may not use this SDK to develop applications for other platforms (including non-compatible implementations of Android) or to develop another SDK. You are of course free to develop applications for other platforms, including non-compatible implementations of Android, provided that this SDK is not used for that purpose. 3.3 You agree that Google or third parties own all legal right, title and interest in and to the SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Google reserves all rights not expressly granted to you. 3.4 You may not use the SDK for any purpose not expressly permitted by the License Agreement. Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. 3.5 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not the License Agreement. 3.6 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Google's sole discretion, without prior notice to you. 3.7 Nothing in the License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features. 3.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK.
4. Use of the SDK by You
4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under the License Agreement in or to any software applications that you develop using the SDK, including any intellectual property rights that subsist in those applications. 4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) the License Agreement and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries). 4.3 You agree that if you use the SDK to develop applications for general public users, you will protect the privacy and legal rights of those users. If the users provide you with user names, passwords, or other login information or personal information, you must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If the user provides your application with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, the user has given you permission to do so. 4.4 You agree that you will not engage in any activity with the SDK, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of any third party including, but not limited to, Google or any mobile communications carrier. 4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through Android and/or applications for Android, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so. 4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under the License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach.
5. Your Developer Credentials
5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials.
6. Privacy and Information
6.1 In order to continually innovate and improve the SDK, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected. 6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Google's Privacy Policy, which is located at the following URL: https://policies.google.com/privacy 6.3 Anonymized and aggregated sets of the data may be shared with Google partners to improve the SDK.
7. Third Party Applications
7.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources. 7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners. 7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, the License Agreement does not affect your legal relationship with these third parties.
8. Using Android APIs
8.1 Google Data APIs 8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by Google or those parties that provide the data (or by other persons or companies on their behalf). Your use of any such API may be subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless allowed by the relevant Terms of Service. 8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so. If you use the Android Recognition Service API, documented at the following URL: https://developer.android.com/reference/android/speech/RecognitionService, as updated from time to time, you acknowledge that the use of the API is subject to the Data Processing Addendum for Products where Google is a Data Processor, which is located at the following URL: https://privacy.google.com/businesses/gdprprocessorterms/, as updated from time to time. By clicking to accept, you hereby agree to the terms of the Data Processing Addendum for Products where Google is a Data Processor.
9. Terminating this License Agreement
9.1 The License Agreement will continue to apply until terminated by either you or Google as set out below. 9.2 If you want to terminate the License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials. 9.3 Google may at any time, terminate the License Agreement with you if: (A) you have breached any provision of the License Agreement; or (B) Google is required to do so by law; or (C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated its relationship with Google or ceased to offer certain parts of the SDK to you; or (D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country in which you are resident or from which you use the service, or the provision of the SDK or certain SDK services to you by Google is, in Google's sole discretion, no longer commercially viable. 9.4 When the License Agreement comes to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst the License Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall continue to apply to such rights, obligations and liabilities indefinitely.
10. DISCLAIMER OF WARRANTIES
10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE. 10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. 10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
11. LIMITATION OF LIABILITY
11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
12. Indemnification
12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you with the License Agreement.
13. Changes to the License Agreement
13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Google will make a new version of the License Agreement available on the website where the SDK is made available.
14. General Legal Terms
14.1 The License Agreement constitutes the whole legal agreement between you and Google and governs your use of the SDK (excluding any services which Google may provide to you under a separate written agreement), and completely replaces any prior agreements between you and Google in relation to the SDK. 14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in the License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google. 14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of the License Agreement is invalid, then that provision will be removed from the License Agreement without affecting the rest of the License Agreement. The remaining provisions of the License Agreement will continue to be valid and enforceable. 14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to the License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of the License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to the License Agreement. 14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. 14.6 The rights granted in the License Agreement may not be assigned or transferred by either you or Google without the prior written approval of the other party. Neither you nor Google shall be permitted to delegate their responsibilities or obligations under the License Agreement without the prior written approval of the other party. 14.7 The License Agreement, and your relationship with Google under the License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from the License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction. July 27, 2021
 I have read and agree with the above terms and conditions
Download Android Studio Jellyfish | 2023.3.1 Patch 1 for ChromeOS
android-studio-2023.3.1.19-cros.deb
<manifest>
  <uses-sdk android:minSdkVersion="5" />
  ...
</manifest>
import android.webkit.CookieManager
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
  lateinit var webView: WebView

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    webView = findViewById(R.id.webview)

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
    // Let the web view use JavaScript.
    webView.settings.javaScriptEnabled = true
    // Let the web view access local storage.
    webView.settings.domStorageEnabled = true
    // Let HTML videos play automatically.
    webView.settings.mediaPlaybackRequiresUserGesture = false

    // Load the URL for optimized web view performance.
    webView.loadUrl("https://webview-api-for-ads-test.glitch.me")
  }
}
import android.webkit.CookieManager
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
  lateinit var webView: WebView

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    webView = findViewById(R.id.webview)

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
    // Let the web view use JavaScript.
    webView.settings.javaScriptEnabled = true
    // Let the web view access local storage.
    webView.settings.domStorageEnabled = true
    // Let HTML videos play automatically.
    webView.settings.mediaPlaybackRequiresUserGesture = false
  }
}
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
https://webview-api-for-ads-test.glitch.me#webview-settings-tests
import android.webkit.CookieManager
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
  lateinit var webView: WebView

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    webView = findViewById(R.id.webview)

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
    // Let the web view use JavaScript.
    webView.settings.javaScriptEnabled = true
    // Let the web view access local storage.
    webView.settings.domStorageEnabled = true
    // Let HTML videos play automatically.
    webView.settings.mediaPlaybackRequiresUserGesture = false

    // Load the URL for optimized web view performance.
    webView.loadUrl("https://webview-api-for-ads-test.glitch.me")
  }
}
import android.webkit.CookieManager
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
  lateinit var webView: WebView

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    webView = findViewById(R.id.webview)

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)
    // Let the web view use JavaScript.
    webView.settings.javaScriptEnabled = true
    // Let the web view access local storage.
    webView.settings.domStorageEnabled = true
    // Let HTML videos play automatically.
    webView.settings.mediaPlaybackRequiresUserGesture = false
  }
}
import android.webkit.CookieManager;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity {
  private WebView webView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    webView = findViewById(R.id.webview);

    // Let the web view accept third-party cookies.
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
    // Let the web view use JavaScript.
    webView.getSettings().setJavaScriptEnabled(true);
    // Let the web view access local storage.
    webView.getSettings().setDomStorageEnabled(true);
    // Let HTML videos play automatically.
    webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
  }
}
CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
async function createVirtualMachines() {
    createResourceGroup();
    createVirtualNetwork();
    createSubnet();
    createNetworkInterface(resourceGroupName, location, interfaceName);
    const parameter: VirtualMachine = {
        location: location,
        hardwareProfile: {
            vmSize: "Standard_D2_v2",
        },
        storageProfile: {
            imageReference: {
                sku: "2016-Datacenter",
                publisher: "MicrosoftWindowsServer",
                version: "latest",
                offer: "WindowsServer"
            },
            osDisk: {
                caching: "ReadWrite",
                managedDisk: {
                    storageAccountType: "Standard_LRS"
                },
                name: "myVMosdisk",
                createOption: "FromImage"
            },
            dataDisks: [
                {
                    diskSizeGB: 1023,
                    createOption: "Empty",
                    lun: 0
                },
                {
                    diskSizeGB: 1023,
                    createOption: "Empty",
                    lun: 1
                }
            ]
        },
        osProfile: {
            adminUsername: "testuser",
            computerName: "myVM",
            adminPassword: "Placeholder",
            windowsConfiguration: {
                enableAutomaticUpdates: true // need automatic update for reimage
            }
        },
        networkProfile: {
            networkInterfaces: [
                {
                    id: "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/networkInterfaces/" + interfaceName + "",
                    primary: true
                }
            ]
        }
    };
    const poller_result = await computeClient.virtualMachines.beginCreateOrUpdateAndWait(resourceGroupName, virtualMachineName, parameter);
    console.log(poller_result);
    const res = await computeClient.virtualMachines.get(resourceGroupName, virtualMachineName);
    console.log(res);
}
Sorry, Google Voice isn't supported in your country yet
// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: '#FF6347',
        secondary: '#32CD32',
        accent: '#FFD700',
      },
    },
  },
};
npm install @azure/arm-netapp
Copy
import OpenAI from "npm:openai";
import OpenAI from "https://deno.land/x/openai@v4.47.1/mod.ts";

const client = new OpenAI();
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
sudo rm -fv /etc/apt/sources.list.d/thorium.list && \
sudo wget --no-hsts -P /etc/apt/sources.list.d/ \
http://dl.thorium.rocks/debian/dists/stable/thorium.list && \
sudo apt update

sudo apt install thorium-browser
from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
    ManagedOnlineEndpoint,
    ManagedOnlineDeployment,
    Model,
    Environment,
    CodeConfiguration,
)
registry_name = "HuggingFace"
model_name = "bert_base_uncased"
model_id = f"azureml://registries/{registry_name}/models/{model_name}/labels/latest"from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
    ManagedOnlineEndpoint,
    ManagedOnlineDeployment,
    Model,
    Environment,
    CodeConfiguration,
)
registry_name = "HuggingFace"
model_name = "bert_base_uncased"
model_id = f"azureml://registries/{registry_name}/models/{model_name}/labels/latest"
Yes. In Bluetooth mode, you can use tandem mode to connect a second controller to your wirelessly connected Stadia Controller.
<body style="font-family: 'Poppins', Arial, sans-serif">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td align="center" style="padding: 20px;">
                <table class="content" width="600" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #cccccc;">
                    <!-- Header -->
                    <tr>
                        <td class="header" style="background-color: #345C72; padding: 40px; text-align: center; color: white; font-size: 24px;">
                        Responsive Email Template
                        </td>
                    </tr>

                    <!-- Body -->
                    <tr>
                        <td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
                        Hello, All! <br>
                        Lorem odio soluta quae dolores sapiente voluptatibus recusandae aliquam fugit ipsam.
                        <br><br>
                            Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam corporis sint eum nemo animi velit exercitationem impedit. Incidunt, officia facilis  atque? Ipsam voluptas fugiat distinctio blanditiis veritatis.            
                        </td>
                    </tr>

                    <!-- Call to action Button -->
                    <tr>
                        <td style="padding: 0px 40px 0px 40px; text-align: center;">
                            <!-- CTA Button -->
                            <table cellspacing="0" cellpadding="0" style="margin: auto;">
                                <tr>
                                    <td align="center" style="background-color: #345C72; padding: 10px 20px; border-radius: 5px;">
                                        <a href="https://www.yourwebsite.com" target="_blank" style="color: #ffffff; text-decoration: none; font-weight: bold;">Book a Free Consulatation</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
                            Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam corporis sint eum nemo animi velit exercitationem impedit.             
                        </td>
                    </tr>
                    <!-- Footer -->
                    <tr>
                        <td class="footer" style="background-color: #333333; padding: 40px; text-align: center; color: white; font-size: 14px;">
                        Copyright &copy; 2024 | Your brand name
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
Here are the detailed solutions to the questions in each set from the provided document:

### SET-1

1. **Draw an ER Diagram using basic and advanced ER concepts for an Online book store:**
   - Identify entities such as `Books`, `Authors`, `Customers`, `Orders`, `Reviews`.
   - Relationships could include `authored_by` between `Books` and `Authors`, `placed_by` between `Orders` and `Customers`, `reviews` between `Customers` and `Books`.

2. **Create a PL/SQL function to calculate the factorial of a number:**
   ```sql
   CREATE OR REPLACE FUNCTION calculate_factorial(n IN NUMBER) RETURN NUMBER IS
     result NUMBER := 1;
   BEGIN
     FOR i IN 1..n LOOP
       result := result * i;
     END LOOP;
     RETURN result;
   END;
   ```

3. **Retrieve all nurses who are registered:**
   ```sql
   SELECT * FROM Nurse WHERE registered = 'Y';
   ```

4. **Add a new column "phone" to the nurse table:**
   ```sql
   ALTER TABLE Nurse ADD phone VARCHAR2(15);
   ```

5. **Update the registered status of Nurse 'Laverne Roberts' to 'N':**
   ```sql
   UPDATE Nurse SET registered = 'N' WHERE name = 'Laverne Roberts';
   ```

6. **Create a view to display the names and positions of nurses:**
   ```sql
   CREATE VIEW NurseNamesPositions AS
   SELECT name, position FROM Nurse;
   ```

7. **Retrieve the names and positions of all employees (nurses and physicians):**
   ```sql
   SELECT name, position FROM Nurse
   UNION
   SELECT name, position FROM Physician;
   ```

8. **Retrieve the names of all department heads and their respective department names:**
   ```sql
   SELECT d.name AS DepartmentName, e.name AS DepartmentHead
   FROM Department d
   JOIN Employee e ON d.head_id = e.id;
   ```

9. **Retrieve the names of nurses and their respective departments (using nested queries):**
   ```sql
   SELECT n.name, d.name AS DepartmentName
   FROM Nurse n
   JOIN Department d ON n.department_id = d.id;
   ```

10. **Remove the department with department id 2 from the department table:**
    ```sql
    DELETE FROM Department WHERE id = 2;
    ```

### SET-2

1. **Draw an ER Diagram using basic and advanced ER concepts for Online banking:**
   - Entities: `Customers`, `Accounts`, `Transactions`, `Loans`.
   - Relationships: `holds` between `Customers` and `Accounts`, `performs` between `Accounts` and `Transactions`, `has_loan` between `Customers` and `Loans`.

2. **Create a PL/SQL procedure with an OUT parameter to calculate the square and cube of a number:**
   ```sql
   CREATE OR REPLACE PROCEDURE calc_square_cube (n IN NUMBER, square OUT NUMBER, cube OUT NUMBER) AS
   BEGIN
     square := n * n;
     cube := n * n * n;
   END;
   ```

3. **Write a SQL query to display the students who are not from Telangana or Andhra Pradesh:**
   ```sql
   SELECT * FROM Students WHERE state NOT IN ('Telangana', 'Andhra Pradesh');
   ```

4. **Create a view to display the columns Sid Sname for students belonging to Telangana:**
   ```sql
   CREATE VIEW TelanganaStudents AS
   SELECT Sid, Sname FROM Students WHERE state = 'Telangana';
   ```

5. **Display all the female students enrolled under Compcourse and who belong to OBC:**
   ```sql
   SELECT * FROM Students WHERE gender = 'Female' AND course = 'Compcourse' AND category = 'OBC';
   ```

6. **Display the student ids, names, and their percentage:**
   ```sql
   SELECT Sid, Sname, (marks_obtained/total_marks)*100 AS percentage FROM Students;
   ```

7. **Display the students in the ascending order of their names for each course:**
   ```sql
   SELECT * FROM Students ORDER BY course, Sname ASC;
   ```

8. **Write a SQL query to delete all the students' records who have enrolled for Compcourse and who are born after 2002:**
   ```sql
   DELETE FROM Students WHERE course = 'Compcourse' AND birth_date > DATE '2002-01-01';
   ```

9. **Write a SQL query to resize the column state to varchar2(40):**
   ```sql
   ALTER TABLE Students MODIFY state VARCHAR2(40);
   ```

10. **Write a SQL query to display all the student names where the length of the name is 5 characters:**
    ```sql
    SELECT Sname FROM Students WHERE LENGTH(Sname) = 5;
    ```

### SET-3

1. **Draw an ER Diagram using basic and advanced ER concepts for Online Auction System:**
   - Entities: `Auctions`, `Bidders`, `Items`, `Bids`.
   - Relationships: `places` between `Bidders` and `Bids`, `belongs_to` between `Bids` and `Auctions`, `offers` between `Auctions` and `Items`.

2. **Write a PL/SQL program to find the area of a circle:**
   ```sql
   CREATE OR REPLACE PROCEDURE find_area_circle (radius IN NUMBER, area OUT NUMBER) AS
   BEGIN
     area := 3.14159 * radius * radius;
   END;
   ```

3. **Change the position of Physician 'John Dorian' to 'Senior Staff Internist':**
   ```sql
   UPDATE Physician SET position = 'Senior Staff Internist' WHERE name = 'John Dorian';
   ```

4. **Create a view to display the names and positions of physicians who are not interns:**
   ```sql
   CREATE VIEW PhysiciansNotInterns AS
   SELECT name, position FROM Physician WHERE position != 'Intern';
   ```

5. **Retrieve all physicians who are attending physicians:**
   ```sql
   SELECT * FROM Physician WHERE position = 'Attending Physician';
   ```

6. **Retrieve the names of physicians and the departments they belong to (using nested queries):**
   ```sql
   SELECT p.name, d.name AS DepartmentName
   FROM Physician p
   JOIN Department d ON p.department_id = d.id;
   ```

7. **Retrieve the names of physicians who have "Physician" in their position:**
   ```sql
   SELECT name FROM Physician WHERE position LIKE '%Physician%';
   ```

8. **Retrieve the names of nurses who are registered and belong to the Surgery department:**
   ```sql
   SELECT n.name FROM Nurse n
   JOIN Department d ON n.department_id = d.id
   WHERE n.registered = 'Y' AND d.name = 'Surgery';
   ```

9. **Retrieve the names and total number of physicians in each department:**
   ```sql
   SELECT d.name AS DepartmentName, COUNT(p.id) AS NumberOfPhysicians
   FROM Department d
   JOIN Physician p ON d.id = p.department_id
   GROUP BY d.name;
   ```

10. **Delete all nurses who are not registered:**
    ```sql
    DELETE FROM Nurse WHERE registered = 'N';
    ```

### SET-4

1. **Draw an ER Diagram using basic and advanced ER concepts for Library Management system:**
   - Entities: `Books`, `Authors`, `Members`, `Loans`.
   - Relationships: `written_by` between `Books` and `Authors`, `borrowed_by` between `Loans` and `Members`, `contains` between `Loans` and `Books`.

2. **Create a PL/SQL function with parameters to calculate the area of a rectangle:**
   ```sql
   CREATE OR REPLACE FUNCTION calculate_area_rectangle(length IN NUMBER, width IN NUMBER) RETURN NUMBER IS
     area NUMBER;
   BEGIN
     area := length * width;
     RETURN area;
   END;
   ```

3. **Write a query in SQL to display all the information of the employees:**
   ```sql
   SELECT * FROM Employees;
   ```

4. **Write a query in SQL to find the salaries of all employees:**
   ```sql
   SELECT Salary FROM Employees;
   ```

5. **Write a query in SQL to display the unique designations for the employees:**
   ```sql
   SELECT DISTINCT Designation FROM Employees;
   ```

6. **Write a query in SQL to list the emp_name and salary increased by 15%:**
   ```sql
   SELECT emp_name, salary * 1.15 AS IncreasedSalary FROM Employees;
   ```

7. **Write a query in SQL to list the emp_id, salary, and dept_id of all the employees:**
   ```sql
   SELECT emp_id, salary, dept_id FROM Employees;
   ```

8. **Write a query in SQL to list the employees who joined before 1991:**
   ```sql
   SELECT * FROM Employees WHERE joining_date < DATE '1991-01-01';
   ```

9. **Write a query in SQL to display the average salaries of all the employees who work as ANALYST:**
   ```sql
   SELECT AVG(salary) AS AvgSalary FROM Employees WHERE designation = 'ANALYST';
   ```

10. **Create a view to display the employees whose name consists third letter as ‘A’ and salary is between 2600 to 3200:**
    ```sql
    CREATE VIEW SpecificEmployees

 AS
    SELECT * FROM Employees
    WHERE SUBSTR(emp_name, 3, 1) = 'A' AND salary BETWEEN 2600 AND 3200;
    ```

### SET-5

1. **Draw an ER Diagram using basic and advanced ER concepts for Hospital Management system:**
   - Entities: `Patients`, `Doctors`, `Nurses`, `Departments`, `Appointments`.
   - Relationships: `assigned_to` between `Patients` and `Doctors`, `works_in` between `Nurses` and `Departments`, `scheduled_for` between `Appointments` and `Patients`.

2. **Write a PL/SQL Function program to use INOUT:**
   ```sql
   CREATE OR REPLACE PROCEDURE calc_area_perimeter_rectangle(length IN NUMBER, width IN NUMBER, area OUT NUMBER, perimeter OUT NUMBER) AS
   BEGIN
     area := length * width;
     perimeter := 2 * (length + width);
   END;
   ```

3. **Display the structure of nurse and physician tables:**
   ```sql
   DESC Nurse;
   DESC Physician;
   ```

4. **Retrieve the names of all physicians who have a Senior Attending position:**
   ```sql
   SELECT name FROM Physician WHERE position = 'Senior Attending';
   ```

5. **Retrieve the names of physicians who are not heads of any department:**
   ```sql
   SELECT p.name FROM Physician p
   LEFT JOIN Department d ON p.id = d.head_id
   WHERE d.head_id IS NULL;
   ```

6. **Retrieve the names of physicians whose positions start with 'Surgical':**
   ```sql
   SELECT name FROM Physician WHERE position LIKE 'Surgical%';
   ```

7. **Retrieve the names of physicians who have the same position as Nurse 'Carla Espinosa':**
   ```sql
   SELECT p.name FROM Physician p
   JOIN Nurse n ON p.position = n.position
   WHERE n.name = 'Carla Espinosa';
   ```

8. **Modify the data type of the "ssn" column in the physician table:**
   ```sql
   ALTER TABLE Physician MODIFY ssn VARCHAR2(20);
   ```

9. **Remove the department with department id 1 from the department table:**
    ```sql
    DELETE FROM Department WHERE id = 1;
    ```

10. **Create a view to display the names and SSNs of physicians with the position 'Attending Physician':**
    ```sql
    CREATE VIEW AttendingPhysicians AS
    SELECT name, ssn FROM Physician WHERE position = 'Attending Physician';
    ```

### SET-6

1. **Draw an ER Diagram using basic and advanced ER concepts for Online food order system:**
   - Entities: `Customers`, `Restaurants`, `Orders`, `MenuItems`, `Delivery`.
   - Relationships: `places` between `Customers` and `Orders`, `contains` between `Orders` and `MenuItems`, `delivered_by` between `Delivery` and `Orders`.

2. **Create a PL/SQL procedure with parameters to calculate the square of a number:**
   ```sql
   CREATE OR REPLACE PROCEDURE calc_square (n IN NUMBER, square OUT NUMBER) AS
   BEGIN
     square := n * n;
   END;
   ```

3. **Display Supplier numbers and Supplier names whose name starts with ‘R’:**
   ```sql
   SELECT supplier_number, supplier_name FROM Suppliers WHERE supplier_name LIKE 'R%';
   ```

4. **Display the name of suppliers who supply Processors and whose city is Delhi:**
   ```sql
   SELECT s.supplier_name FROM Suppliers s
   JOIN Supplies sp ON s.supplier_id = sp.supplier_id
   WHERE sp.item_name = 'Processor' AND s.city = 'Delhi';
   ```

5. **Display the names of suppliers who supply the same items as supplied by Ramesh:**
   ```sql
   SELECT DISTINCT s2.supplier_name FROM Suppliers s1
   JOIN Supplies sp1 ON s1.supplier_id = sp1.supplier_id
   JOIN Supplies sp2 ON sp1.item_name = sp2.item_name
   JOIN Suppliers s2 ON sp2.supplier_id = s2.supplier_id
   WHERE s1.supplier_name = 'Ramesh' AND s2.supplier_name != 'Ramesh';
   ```

6. **Write a SQL query to increase the price of Keyboard by 200:**
   ```sql
   UPDATE Items SET price = price + 200 WHERE item_name = 'Keyboard';
   ```

7. **Write a SQL query to display supplier numbers, supplier names, and item_price for suppliers in Delhi in the ascending order of item_price:**
   ```sql
   SELECT s.supplier_number, s.supplier_name, i.price
   FROM Suppliers s
   JOIN Supplies sp ON s.supplier_id = sp.supplier_id
   JOIN Items i ON sp.item_id = i.item_id
   WHERE s.city = 'Delhi'
   ORDER BY i.price ASC;
   ```

8. **Write a SQL query to add a new column called CONTACTNO:**
   ```sql
   ALTER TABLE Suppliers ADD CONTACTNO VARCHAR2(15);
   ```

9. **Delete the record whose item_price is the lowest of all the items supplied:**
   ```sql
   DELETE FROM Items WHERE price = (SELECT MIN(price) FROM Items);
   ```

10. **Create a view on the table which displays only supplier numbers and supplier names:**
    ```sql
    CREATE VIEW SupplierInfo AS
    SELECT supplier_number, supplier_name FROM Suppliers;
    ```

### SET-7

1. **Draw an ER Diagram using basic and advanced ER concepts for Hotel Management system:**
   - Entities: `Guests`, `Rooms`, `Reservations`, `Services`, `Staff`.
   - Relationships: `reserves` between `Guests` and `Reservations`, `provides` between `Services` and `Guests`, `assigned_to` between `Staff` and `Rooms`.

2. **Write a PL/SQL Program to print the salary changes when the salary is changed by using a trigger:**
   ```sql
   CREATE OR REPLACE TRIGGER salary_change_trigger
   BEFORE UPDATE OF salary ON Employees
   FOR EACH ROW
   BEGIN
     DBMS_OUTPUT.PUT_LINE('Old Salary: ' || :OLD.salary || ', New Salary: ' || :NEW.salary);
   END;
   ```

3. **Find courses with credit hours greater than the average:**
   ```sql
   SELECT * FROM Courses WHERE credit_hours > (SELECT AVG(credit_hours) FROM Courses);
   ```

4. **Retrieve students with last name starting with 'D':**
   ```sql
   SELECT * FROM Students WHERE last_name LIKE 'D%';
   ```

5. **Change the instructor's name of a specific course:**
   ```sql
   UPDATE Courses SET instructor_name = 'New Instructor' WHERE course_id = 101;
   ```

6. **Create a view for students with GPA > 3.8:**
   ```sql
   CREATE VIEW HighGPAStudents AS
   SELECT * FROM Students WHERE GPA > 3.8;
   ```

7. **Find courses taken by students with high GPA:**
   ```sql
   SELECT DISTINCT c.course_name FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   JOIN Students s ON e.student_id = s.student_id
   WHERE s.GPA > 3.8;
   ```

8. **Retrieve students enrolled in multiple courses:**
   ```sql
   SELECT s.student_name FROM Students s
   JOIN Enrollments e ON s.student_id = e.student_id
   GROUP BY s.student_name HAVING COUNT(e.course_id) > 1;
   ```

9. **Count students enrolled in courses with credit hours less than 4:**
   ```sql
   SELECT c.course_name, COUNT(e.student_id) AS NumberOfStudents
   FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   WHERE c.credit_hours < 4
   GROUP BY c.course_name;
   ```

10. **Alter the students table to add a new column 'Rank':**
    ```sql
    ALTER TABLE Students ADD Rank NUMBER;
    ```

### SET-8

1. **Draw an ER Diagram using basic and advanced ER concepts for “Flipkart”:**
   - Entities: `Users`, `Products`, `Orders`, `Categories`, `Reviews`.
   - Relationships: `places` between `Users` and `Orders`, `contains` between `Orders` and `Products`, `categorized_as` between `Products` and `Categories`.

2. **Create a trigger to update the Instructor's Name in Courses table when it is updated in Students table:**
   ```sql
   CREATE OR REPLACE TRIGGER update_instructor_name
   AFTER UPDATE OF instructor_name ON Students
   FOR EACH ROW
   BEGIN
     UPDATE Courses SET instructor_name = :NEW.instructor_name
     WHERE instructor_id = :OLD.instructor_id;
   END;
   ```

3. **Alter students table to add Email column:**
   ```sql
   ALTER TABLE Students ADD Email VARCHAR2(50);
   ```

4. **Update Email for a specific student:**
   ```sql
   UPDATE Students SET Email = 'newemail@example.com' WHERE student_id = 101;
   ```

5. **Find courses with enrollments having students with GPA less than any specific value:**
   ```sql
   SELECT DISTINCT c.course_name FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   JOIN Students s ON e.student_id = s.student_id
   WHERE s.GPA <

 3.0;
   ```

6. **Create a view for students in a specific course:**
   ```sql
   CREATE VIEW SpecificCourseStudents AS
   SELECT s.student_name FROM Students s
   JOIN Enrollments e ON s.student_id = e.student_id
   WHERE e.course_id = 101;
   ```

7. **Retrieve students enrolled in courses taught by a specific instructor:**
   ```sql
   SELECT s.student_name FROM Students s
   JOIN Enrollments e ON s.student_id = e.student_id
   JOIN Courses c ON e.course_id = c.course_id
   WHERE c.instructor_name = 'Dr. Smith';
   ```

8. **Count the number of students per course:**
   ```sql
   SELECT c.course_name, COUNT(e.student_id) AS NumberOfStudents
   FROM Courses c
   JOIN Enrollments e ON c.course_id = e.course_id
   GROUP BY c.course_name;
   ```

9. **Find courses not taken by any students:**
   ```sql
   SELECT * FROM Courses c
   WHERE NOT EXISTS (
     SELECT 1 FROM Enrollments e WHERE c.course_id = e.course_id
   );
   ```

10. **Alter the table to drop the Email column:**
    ```sql
    ALTER TABLE Students DROP COLUMN Email;
    ```

### SET-9

1. **Draw an ER Diagram using basic and advanced ER concepts for Inventory Management System:**
   - Entities: `Products`, `Suppliers`, `Orders`, `Warehouses`.
   - Relationships: `supplies` between `Suppliers` and `Products`, `stored_in` between `Products` and `Warehouses`, `contains` between `Orders` and `Products`.

2. **Create a trigger to log changes in inventory quantities:**
   ```sql
   CREATE OR REPLACE TRIGGER log_inventory_changes
   AFTER UPDATE OF quantity ON Inventory
   FOR EACH ROW
   BEGIN
     INSERT INTO InventoryLog (product_id, old_quantity, new_quantity, change_date)
     VALUES (:OLD.product_id, :OLD.quantity, :NEW.quantity, SYSDATE);
   END;
   ```

3. **Add a new column 'Discount' to the Orders table:**
   ```sql
   ALTER TABLE Orders ADD Discount NUMBER(5,2);
   ```

4. **Update the discount for a specific order:**
   ```sql
   UPDATE Orders SET Discount = 10 WHERE order_id = 102;
   ```

5. **Find products with quantity less than a specified threshold:**
   ```sql
   SELECT * FROM Products WHERE quantity < 50;
   ```

6. **Create a view to display the details of products from a specific supplier:**
   ```sql
   CREATE VIEW SupplierProducts AS
   SELECT p.* FROM Products p
   JOIN Supplies s ON p.product_id = s.product_id
   WHERE s.supplier_id = 201;
   ```

7. **Retrieve orders containing products from a specific warehouse:**
   ```sql
   SELECT o.order_id, o.order_date FROM Orders o
   JOIN OrderDetails od ON o.order_id = od.order_id
   JOIN Products p ON od.product_id = p.product_id
   WHERE p.warehouse_id = 301;
   ```

8. **Count the number of products supplied by each supplier:**
   ```sql
   SELECT s.supplier_name, COUNT(p.product_id) AS NumberOfProducts
   FROM Suppliers s
   JOIN Supplies sp ON s.supplier_id = sp.supplier_id
   JOIN Products p ON sp.product_id = p.product_id
   GROUP BY s.supplier_name;
   ```

9. **Find suppliers who do not supply any products:**
   ```sql
   SELECT * FROM Suppliers s
   WHERE NOT EXISTS (
     SELECT 1 FROM Supplies sp WHERE s.supplier_id = sp.supplier_id
   );
   ```

10. **Alter the Orders table to drop the Discount column:**
    ```sql
    ALTER TABLE Orders DROP COLUMN Discount;
    ```

This detailed summary provides the necessary SQL statements and PL/SQL code snippets required for each of the tasks in the provided document, along with a brief explanation of the ER diagrams that should be created for each scenario.
devpod up https://github.com/madskristensen/NpmTaskRunner
star

Fri May 31 2024 06:19:51 GMT+0000 (Coordinated Universal Time) https://learning.ccbp.in/problems-set?auth_code

@karthiksalapu

star

Fri May 31 2024 06:14:13 GMT+0000 (Coordinated Universal Time) https://learning.ccbp.in/problems-set?auth_code

@karthiksalapu ##dictionaries ##iteration

star

Fri May 31 2024 04:29:07 GMT+0000 (Coordinated Universal Time) https://github.com/YadlaMani/Java-Lab

@signup

star

Fri May 31 2024 03:06:48 GMT+0000 (Coordinated Universal Time) https://www.file.io/kuz2/download/kJNthk9ZJrjW

@signup

star

Fri May 31 2024 03:06:47 GMT+0000 (Coordinated Universal Time) https://www.file.io/kuz2/download/kJNthk9ZJrjW

@signup

star

Fri May 31 2024 03:06:46 GMT+0000 (Coordinated Universal Time) https://www.file.io/kuz2/download/kJNthk9ZJrjW

@signup

star

Fri May 31 2024 03:01:43 GMT+0000 (Coordinated Universal Time) https://www.file.io/jTfn/download/9Ix5SNFQo6Or

@signup

star

Fri May 31 2024 01:13:49 GMT+0000 (Coordinated Universal Time)

@signup

star

Thu May 30 2024 22:39:48 GMT+0000 (Coordinated Universal Time)

@rmdnhsn #blogger

star

Thu May 30 2024 22:23:48 GMT+0000 (Coordinated Universal Time)

@Leda

star

Thu May 30 2024 21:24:43 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 30 2024 21:06:23 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 30 2024 21:05:25 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 30 2024 21:04:07 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 30 2024 20:35:23 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 30 2024 16:21:27 GMT+0000 (Coordinated Universal Time)

@rmdnhsn #vba

star

Thu May 30 2024 15:52:28 GMT+0000 (Coordinated Universal Time) https://webmasters.stackexchange.com/questions/141549/how-to-deploy-a-single-html-file-to-static-hosting-and-have-it-show-up-for-reque

@shookthacr3ator

star

Thu May 30 2024 14:58:31 GMT+0000 (Coordinated Universal Time) https://github.com/daattali/cashflow-calculation-extension

@curtisbarry

star

Thu May 30 2024 14:57:56 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/53343181/detailed-reporting-cypress-mochawesome

@al.thedigital #javascript #mochawesome #report

star

Thu May 30 2024 14:50:34 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/actions/quickstart

@shookthacr3ator

star

Thu May 30 2024 14:37:38 GMT+0000 (Coordinated Universal Time) https://web-share-in-third-party-iframe.glitch.me/

@shookthacr3ator

star

Thu May 30 2024 14:16:23 GMT+0000 (Coordinated Universal Time) https://calculator.apps.chrome/favicon.ico

@curtisbarry

star

Thu May 30 2024 12:53:19 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/19807665/auto-refresh-for-every-5-mins

@Bh@e_LoG #javascript

star

Thu May 30 2024 12:47:10 GMT+0000 (Coordinated Universal Time) https://www.pyramidions.com/mobile-app-development-chennai.html

@Bastina_1

star

Thu May 30 2024 11:50:22 GMT+0000 (Coordinated Universal Time)

@anchal_llll

star

Thu May 30 2024 10:47:46 GMT+0000 (Coordinated Universal Time) https://github.com/creativecommons/global-network-strategy

@curtisbarry

star

Thu May 30 2024 10:23:26 GMT+0000 (Coordinated Universal Time) https://developer.android.com/training/wearables/versions/5/setup

@curtisbarry

star

Thu May 30 2024 10:16:11 GMT+0000 (Coordinated Universal Time) https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels

@calazar23 #xml

star

Thu May 30 2024 10:10:51 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:10:46 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:09:57 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:09:13 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23

star

Thu May 30 2024 10:09:08 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:08:32 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #kotlin

star

Thu May 30 2024 10:08:25 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #java

star

Thu May 30 2024 10:08:15 GMT+0000 (Coordinated Universal Time) https://developers.google.com/ad-manager/mobile-ads-sdk/android/browser/webview

@calazar23 #java

star

Thu May 30 2024 10:00:23 GMT+0000 (Coordinated Universal Time) https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/next-generation-quickstart.md

@Shookthadev999

star

Thu May 30 2024 10:00:03 GMT+0000 (Coordinated Universal Time) https://voice.google.com/u/0/blocked

@curtisbarry

star

Thu May 30 2024 09:28:59 GMT+0000 (Coordinated Universal Time)

@calazar23

star

Thu May 30 2024 09:12:46 GMT+0000 (Coordinated Universal Time) https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-arm-netapp/21.0.0/index.html

@Shookthadev999

star

Thu May 30 2024 08:45:10 GMT+0000 (Coordinated Universal Time) https://deno.land/x/openai@v4.47.1

@Shookthadev999

star

Thu May 30 2024 08:45:04 GMT+0000 (Coordinated Universal Time) https://deno.land/x/openai@v4.47.1

@Shookthadev999

star

Thu May 30 2024 07:54:36 GMT+0000 (Coordinated Universal Time) https://forums.garmin.com/sports-fitness/running-multisport/f/forerunner-745/245640/software-version-3-40---forerunner-745---live

@curtisbarry

star

Thu May 30 2024 07:46:54 GMT+0000 (Coordinated Universal Time) https://thorium.rocks/

@Shookthadev999

star

Thu May 30 2024 07:41:21 GMT+0000 (Coordinated Universal Time)

@Shookthadev999 #undefined

star

Thu May 30 2024 07:39:25 GMT+0000 (Coordinated Universal Time) https://support.google.com/stadia/answer/13067284?sjid

@curtisbarry

star

Thu May 30 2024 06:58:17 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/how-to-create-a-responsive-html-email-template/

@Disdark10 #html

star

Thu May 30 2024 05:44:49 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/user/dashboard

@tushar1256

star

Thu May 30 2024 04:10:41 GMT+0000 (Coordinated Universal Time)

@signup

star

Thu May 30 2024 00:48:21 GMT+0000 (Coordinated Universal Time) https://devpod.sh/open#https://github.com/madskristensen/NpmTaskRunner

@shookthacr3ator

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension