Internet access in Android

If You want to access some internet resouces from your Android app you add

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

to your AndroidManifest.xml

When You have resources which do not use TLS (https but just http) you have to add

<application
        ...
        android:usesCleartextTraffic="true">
</application>

SQL-Basics: Relations

As the Junior Data Scientist of Knight Industries we created a table to keep track of all our operatives: SQL-Basics: Create, Read, Update, Delete

Devon asks us to keep track of our operations aka missions as well. For the first implementation let us assume that a mission has one operative and an operative can participate in multiple missions. that’s what we call an 1 to many relationship.

  +------------+                 +----------+
  |            |1   active in   n|          |
  | operative  +-----------------+ missions |
  |            |                 |          |
  +------------+                 +----------+

Missions have an id, a code name like “Phantom Liberty”, an operative id and a total cost. Continue reading “SQL-Basics: Relations”

SQL-Functions

In SQL-Basics

we learned the standard SQL statements to create a table, insert data into it, retrieving data from tables and altering data. Now we want to do even

Devon is a data driven man and to evaluate our mission, he likes to know from us:

    • how many missions we finished
    • the total cost of all missions
    • the mission with the lowest cost
    • the mission with the highest cost
    • the average mission cost
    • the five most expensive missions

 

SELECT COUNT(*) FROM missions;
SELECT SUM(total_cost) FROM missions;
SELECT MIN(total_cost) FROM missions;
SELECT MAX(total_cost) FROM missions;
SELECT AVG(total_cost) FROM missions;
SELECT * FROM missions ORDER BY total_cost DESC LIMIT 5;