Database Management: SQL Select

Please note that the following blog post provides a summary view for what you need to get done (left column) and quick examples that illustrate how to do it in SQL (right column with SQL code in red). For more information please see the resources below:

  FROM dept
SELECT ename, sal, 12*(sal+100)
  FROM emp
Column Alias
SELECT ename, AS name, sal salary
  FROM emp
Eliminating Duplicate Rows
  FROM emp
Selecting with WHERE
SELECT ename, job, deptno
  FROM emp
  WHERE job=’Clerk’
Comparison Operators in WHERE
SELECT ename, sal, comm
  FROM emp
  WHERE sal<=comm
Between Operators in WHERE
SELECT ename, sal, comm
  FROM emp
  WHERE sal BETWEEN 1000 AND 1500
Test Values in a list
SELECT ename, empno, mgr
  FROM emp
  WHERE mgr IN (7902, 7566, 7788)
Pattern Matching in WHERE

_ is one space character *

% is trailing characters *

* is all characters

SELECT ename
  FROM emp
  WHERE ename LIKE ‘_A%’
Both conditions in WHERE are true
SELECT ename, empno, job, sal
  FROM emp
  WHERE sal>=1100
  AND job=’Clerk’
One or the other in WHERE are true
SELECT ename, empno, job, sal
  FROM emp
  WHERE sal>=1100
  OR job=’Clerk’
Not Operator in WHERE
SELECT ename, empno, job, sal
  FROM emp
  WHERE job NOT IN (’Clerk’, ’Manager’, ’Analyst,)
Sort rows
SELECT ename, job, deptno, hiredate
  FROM emp
  ORDER BY hiredate
Descending order sorting of rows
SELECT ename, job, deptno, hiredate
  FROM emp
  ORDER BY hiredate DESC
Table aliases
SELECT e.empno, e.ename, e.deptno,  d.deptno, d.loc
  FROM emp e, dept d
  WHERE e.deptno = d.deptno


Database Management: SQL Basics

Please note that the following blog post provides a summary view for what you need to get done (left column) and quick examples that illustrate how to do it in SQL (right column with SQL code in red). For more information please see the resources below:

Create table
  (deptno NUMERIC(2),
   dname VARCHAR(14),
   loc VARCHAR(14))
Add Column
  ADD job VARCHAR (9);
Rename Table
RENAME dept TO department
Rename Column
Delete Table
Not Null in a table (forcing there to be a value in that variable in the table)
  (deptno NUMERIC(2) NOT NULL,
   dname VARCHAR(14),
   loc VARCHAR(14))
Unique (allows for null values, but doesn’t allow for the same variable to be repeated)
  (deptno NUMERIC(2),
   dname VARCHAR(14),
   loc VARCHAR(14),
   CONSTRAINT dept_dname_uk UNIQUE (dname))
Primary Key (doesn’t allow for null values)
  (deptno NUMERIC(2),
    dname VARCHAR(14),
    loc VARCHAR(14),
    CONSTRAINT dept_dname_uk UNIQUE (dname),
    CONSTRAINT dept_deptno_pk PRIMARY KEY(deptno))
Foreign Keys (connect data with other tables)
  (empno NUMERIC(4),
   ename VARCHAR(10) NOT NULL,
   job VARCHAR(9),
   mgr NUMERIC(4),
   hiredate DATETIME,
   sal MONEY,
   comm MONEY,
   deptno NUMERIC(2) NOT NULL,
   CONSTRAINT emp_deptno_fk FOREIGN KEY (deptno) REFERENCES dept (deptno))
Check Constraints (sanity checks)
  (deptno NUMERIC(2),
    dname VARCHAR(14),
    loc VARCHAR(14),
    CONSTRAINT dept_dname_uk UNIQUE (dname),
    CONSTRAINT dept_deptno_pk PRIMARY KEY(deptno),
    CONSTRAINT emp_deptno_ck CHECK (deptno BETWEEN 10 AND 99))
Insert new rows of data
INSERT INTO dept (deptno, dname, loc)
  VALUES (50, ‘development’, ‘Detroit’)
Change data within the table
  SET deptno = 20
  WHERE empno = 7782
Removing a row form a table
  WHERE dname = ‘development’
Removing data entry in all tables (CAUTION)
  WHERE dname = ‘development’


  • When doing delete stuff, do a SELECT statement with the WHERE clause to make sure you are not shooting in the dark.


Sample SQL sets: Querying Tables

Below is an ERD of a database supporting the basic revenue business cycle.


Important: Use only the information that is given in the request in creating your queries.

Queries Examples:

  1. Provide a list of the descriptions and list prices of all the products the company
Select ProdDesc Description, ListPrice Prices
     From Product
  1. What products does the company have at least 10 items in stock?
Select ProdDesc Description, QuantityOnHand AS 'Quantity Available'
     From Product
          Where QuantityOnHand >= 10
  1. Sort all of the product descriptions in alphabetical order.
Select ProdDesc Description
     From Product
          Order by ProdDesc
  1. What are the names of the customers who live in Oklahoma or Arizona?
Select LName + ', ' + FName AS Name, State
     From Customer
          Where State = 'OK'
          or State = 'AZ'
  1. How many items on hand does the company have for the following product ids: (1, 4, 9, 10, 13, 22)?
Select ProductID, ProdDesc Description, QuantityOnHand AS 'Quantity Available'
     From Product
          Where ProductID IN (1,4,9,10,13,22)
  1. Which customers made orders on August 23, 2008 (no redundancy in results)?
Select Distinct CustomerID, OrderDate
     From Orders
          Where OrderDate='August 23, 2008'
  1. Which customers have ordered printers (no redundancy in results)?
Select Distinct o.CustomerID, p.ProdDesc
     From Orderline ol, Product p, orders o
          Where o.OrderID = ol.OrderID
          and ol.ProductID = p.ProductID
          and ProdDesc='printer'

8. Table Creation

Create a table called BackOrder. BackOrder should have the following columns: BO_ID, DelayDesc, Date, and ProductID.

When you create BackOrder, you must specify a PK constraint for BO_ID and an FK constraint for ProductID. DelayDesc should be a VarChar data type and can be null. The date should be a date data type and cannot be null.

Create Table BackOrder
       BO_ID Numeric(4),
       DelayDesc Varchar(15),
       Date Datetime Not Null,
       ProductID Numeric(18) Not Null,
       Constraint BackOrder_hern5717_BO_ID_pk Primary Key (BO_ID),
       Constraint Product_productID_fk Foreign Key (ProductID) References product(ProductID)

Insert a few lines into the table, then delete the lines.

Insert into BackOrder (BO_ID, DelayDesc, Date, ProductID)
   values (1,'Oklahoma Constitution', '1/14/2014', 1),
    (2,'Utah Constitution', '12/23/2013', 1),
    (3,'New Mexico Constitution', '12/21/2013', 1)

Delete from BackOrder
       Where BO_ID = 2


3 conferences in Computer Science and 3 conferences in Big Data

3 scholarly conferences that focus on algorithms, programming languages, managing telecommunications software engineering, managing corporate information resources, and managing partnership-based IT operations:

  1. Advance International Conference on Telecommunications:
  2. IEEE International Conference on Software, Telecommunications and Computer Networks (SoftCOM)
  3. IEEE Global Communication Conference Exhibition & Industry Forum (GLOBECOM)

3 conferences that cover Big Data:

1. IEEE International Conference on BigData:

A conference that provides student travel awards to help subsidize the cost, thanks to the National Science Foundation. Held in Washington DC in 2014. They also provide a doctoral symposium. Keynote speeches include Never-ending language learning; Smart Data – How you and I will exploit Big Data for personalized digital health and many other activities; and Addressing Human Bottlenecks in Big data. Reading the keynote speeches’ abstracts I found this quote to be true at my job in the past year “… the key bottlenecks lie with data analysis and data engineers, who are routinely asked to work with data that cannot possibly be loaded into tools for statistical analytics or visualization.” (IEEE, 2014). Another Keynote talks about an Artificial Intelligence learning machine NELL (Never-Ending Language Learner) that runs 24 hours per day learning to read the web and extracting knowledge and creating beliefs. It is starting to reason over its extracted knowledge. It recently learned that “inaccuracy is an event outcome” (NELL, 2015)

2. Data Lead:

Held in Paris, France in 2015 and Berkeley, California near October and November months. It is their second year of this annual conference. It is in partnership with the University of California (Berkeley) Hass School of Business. Their goal is to spark an international conversation on the application of big data on business processes and issues. There is a particular focus on issues revolving around finance and a marketing, though they cater to the sciences, education, government, etc. They see big data as an economic commodity.

3. IARIA International Conference on Data Analytics:

Fourth conference held by IARIA, in Nice, France for 2015, during the middle of the year. Topics in their conferences deal with: Fundamentals, mechanisms, and features, sentiment/opinion analytics, target analytics, big data, knowledge discovery, visualization, filtering data, relevant/redundant/obsolete analytics, predictive, trust in data, legal issues, cyber threats, etc. They have two biannual peer-reviewed journals since 2008 associated with this group: International Journal on Advances in Software & International Journal on Advances in Intelligent Systems. Other conferences from IARIA: SoftNet, InfoWare, NetWare, NexTech, DataSys, BioSciencesWorld, Infosys, and NexComm, all in Europe.

3 Journals in Computer Science and 3 Journals in Big Data

3 journals that focus on algorithms, programming languages, managing telecommunications software engineering, managing corporate information resources, and managing partnership-based information technology (IT) operations:

Internal Journal of e-Collaboration:

It is a peer-reviewed journal that studies both in theory and practical findings that relate to implementation and design of collaboration tools: email, listservs, teleconferences, automate workflow, and demand management. This is extremely vital for those managers who feel that you can be a differentiator between groups and other companies via your application of collaboration tools. It is published quarterly, since 2005.

Journal of the ACM:

Editor and peer-reviewed process that covers articles about the design, semantics, implementation, and application of programming languages. Topics discussed: Parsing, compiling, optimization (like High-Performance Computing), run-time organization, data abstraction, modularity, parallelism, concurrency, domain and category theory, database systems and theory, algorithms and data structures, Artificial Intelligence, etc. Published bimonthly, since 1954.

European Association for Programming Languages and Systems (EAPLS E-journal):

A peer-reviewed process, which covers function and logic programming, with a focus on the integration of paradigms. Been in publication since 1995 and it publishes yearly.

3 journals that cover big data:

Big Data:

Since 2013, this is a quarterly peer-reviewed journal. Reports on the current state of storing, organizing, protecting, manipulating large data sets. It also explores challenges and opportunities in data discovery.

Intelligent Data Analysis:

Focused on Artificial Intelligence techniques in data analytics across all disciplines: visualization of data, data pre-processing, mining techniques, tools, and apps, machine learning, neural nets, fuzzy logic, stats pattern recognition, filtering, etc. 70% of papers are applications oriented and 30% is theoretical work. Published bimonthly and since 1996.

CODATA Data Science Journal:

Biannual peer-reviewed e-journal since 2002, which covers: data, databases, processing, complexity, scalability, distribution, interaction, application, interface with experiments, models, and information complexes, etc.

A Letter of Gratitude to Dr. Shaila Miranda

Dr. Shaila Miranda has taught me that I am the author of my story. I have known Dr. Shaila Miranda for many years. During this period, she has outperformed as a mentor and an educator. Throughout my two years at the University of Oklahoma, Dr. Miranda has taken the initiative to know her students on a personal level. I first met Dr. Miranda at a riveting presentation she gave at the M.B.A. Program Prelude Week. After further interactions with Dr. Miranda, she inspired me to seek a dual-masters-degree, M.B.A. and M.S. in M.I.S rather than the traditional M.B.A degree. Dr. Miranda helped me realized my hidden passion for information systems [technology]. It takes an exceptional mentor to recognize and instill a vision so powerful that it can alter the course of a mentee.

A few semesters after our original meeting, she learned about a non-profit I was about to start. She saw how I leveraged social media to forward the cause. This inspired her to become a Sooner Ally, and other M.I.S. faculty followed suit. This demonstrates the passion and the conviction as an outstanding educator. Dr. Miranda is willing to listen, learn, and act based on her interactions with students just as much as she is willing to support them. She was demonstrating social awareness and became a model professor for those other professors in the department but model inclusive behavior to her students.

As one of her students, I was completely engaged in the course she was teaching. Her curriculum was remarkable, her lectures and active learning with real world data gave the class an invaluable insight. Dr. Miranda’s passion and commitment towards education could be seen throughout the semester when she sought employees from Devon, and other local companies, to help facilitate our education. This was her demonstrating managing relationships, which has allowed her to educate her students at a deeper level.

Her commitment to her students did not end at the end of the term. This was evident when she nominated me to represent the University of Oklahoma at the Information Systems and Walmart IT Summit. She coached the students individually, and as a group, to give us a competitive edge in the competition. As if that was not enough, her commitment to her students is so vast that she drove the team to Arkansas and attended our presentations with a video recorder at hand. It was with her lessons that took our team to 3rd place in the Walmart IT Summit Competition. She made us self-aware of ourselves and our surroundings; this is what gave us the competitive edge.

As graduation neared, she arranged mock interviews helped me land two job offers. Upon receiving both job offers, she assisted me in the decision-making process. She engaged my self-awareness and self-management sides of emotional intelligence to help me make the right decision. It was that decision, that got me the job I have now, that has allowed me to attend Colorado Technical University, to finally complete the doctorate. Thus, words cannot express how grateful I am for this outstanding educator. She got to know me as an individual, mentored me, and made me who I am today.

She had believed in me when others didn’t, and for that, I am grateful for it. She developed me into the person I am today, and she even provided me a key piece of advice towards my dissertation (the tool I eventually used to analyze my data), and she wasn’t even in the same school nor in my committee. She was still managing her relationships with me, beyond the years of completing my education in that department. She shows me that the boundaries of mentorships and relationships exist outside of an organization and traverses time. This is what I can learn from her, to believe in people that you lead.

Compelling Topics in Leadership

Leadership Theories:

  • Chapman and Sisodia (2015) define leadership as the value they bring to people. The author’s primary guiding value is that “We measure success by the way we touch the lives of people.” This type of leadership practice stems from treating their followers the similarly to how someone would like their kids to be treated in the work environment. This type of leadership relies on coaching the leader’s followers to build on the follower’s greatness. Then recognition is done that shake employee to the core by involving the employee’s family so that the employee’s family could be proud of their spouse or parent. The goal of this type of leadership is to have the employee seen, valued, and heard such that they want to be their best and do their best not just for the company but for their co-workers as well.
  • Cashman (2010) defines leadership from an inside-out approach to personal mastery. This type of leadership style is focused on self-awareness of the leader’s conscious beliefs and shadow beliefs to grow and deepen the leader’s authenticity. Cashman pushes the leader to identify, reflect and recognize their core talents, values and purpose. With the purpose of any leadership is understanding “How am I going to make a difference?” and “How am I going to enhance other people’s lives?” Working from the leader’s core purpose releases more of that untapped leader’s energy to do more meaning work that frees the leader and opens leaders up to different possibilities, more so than just working towards a leader’s goals.
  • Open Leadership Has five rules, which allow for respect and empowerment of the customers and employees, to consistently build trust, nurtures curiosity and humility, holding openness accountable, and allows for forgiving failures (Li, 2010).  These leaders must let go of the old mentality of micromanaging because once they do let go of micromanagement, these leaders are now open to growing into new opportunities. This thought process is shared commonalities with knowledge sharing, if people were to share the knowledge that they accumulated, these people would be able to let go of your current tasks, such that these people can focus on new and better opportunities. Li stated that open Leadership allows for leaders to build, deepen, and nurture relationships with the customers and employees.  Open leadership is a theory of leadership that is customer and employee centered.
  • Values-based leadership requires four principles: self-reflection, balance, humble, and self-confidence (Kraemer, 2015). Through self-reflection, leaders identify their core beliefs and values that matter to the leader. Leaders that view situations from multiple perspectives to gain a deeper understanding of the situation are considered balanced. Humility in leaders refers to not forgetting who the leader is and where the leaders come from to gain an appreciation for each person. Finally, self-confidence is the leader accepting themselves as they are, warts and all.

Ethical Behavior

No one wakes up one day and says they will be unethical, however, small acts can build up to unethical behavior (Prentice, 2007). This conclusion on ethics is similar to a slippery slope argument. Understandably, unethical people and unethical actions aren’t equivalent to evil people or evil actions (Prentice, 2007). As stated by Chapman and Sisodia (2015), “Ethics is people.” Ethics usually involves and revolves around people. However, good intentions are not enough to ensure ethical behavior (Prentice, 2007). Thus, Prentice outlined how unethical decisions could be made:

  • Obedience to authority: following orders blindly
  • Conformity bias: observing others in a group and conforming to consciously or unconsciously
  • Incrementalism: the slippery slope argument
  • Group think: pressures to not stand out from a group consensus
  • Over-optimism: irrational beliefs led by a strong tendency of optimistic beliefs
  • Overconfidence: irrational beliefs led by a strong tendency of confidence
  • Selfserving bias: gathering information that only strengthens one’s views or self-interest and discarding challenging viewpoints
  • Framing: how a problem or situation is framed can yield different results
  • Sunk costs: continual consideration and loyalty to a bad idea, just because a significant amount or resources have been poured into the idea
  • The tangible, the close and the near term: having something tangible that is near you and close by weights more than those that are separated by distance or time or in the abstract
  • Loss aversion: people prefer not to act for fear of losing something
  • Endowment effect: people getting attached to something

Power and conflict

“‘Leadership is difficult.’ Inherent in any leadership challenge is stress. Stress comes from the environment, interpersonal conflict, the nature or amount of work, or simply the uncertain of what lies ahead.” (Shankman, Allen, & Haber Curran, 2015). Best teams can fall apart easily, due to conflict, if the conflict is not handled properly (Kraemer, 2015). Thus, when a conflict breaks, there are five strategies that people could use: forcing, accommodating, avoiding, compromising and collaborative; but usually, people tend to gravitate towards one or two of them (Williams, n.d.).

Kraemer (2015), illustrates the example of Campbell Soup, a company that recruited and grew in size with employees that were not aligned with the company’s values, and eventually, these people got promoted. These newly promoted ill-fitted employees were unequipped to create the best teams, and a few bad apples and negative influences almost destroyed the company, because of their concentration on short-term goals rather than long-term goals by increasing the price of their products above the value of private-labeled store brands. The CEO had a lot of changes to make to turn that company around and with change brings conflict. Williams (n.d.), illustrates an example of a conflict where Shaun Williams didn’t handle conflict appropriately, used physical forcing during a football game, which got his team penalized heavily, cost the team the game, and ended the team’s season. However, constructive conflict and trust are needed to openly and honestly have engaging relationships (Cashman, 2010).


Trust is multidimensional and is key to build all types of relationships between teammates, partners, and oneself. Trust is key to help build the best team, where teammates can have a constructive conflict on each other’s ideas to achieve innovation (Cashman, 2010; Kraemer, 2015). This is because all relationships are built on trust, and it takes just one inauthentic or untrustworthy action to ruin the relationship (Shankman, Allen, Haber-Curran, 2015). Once trustworthiness is lost, it takes time and hard work to regain it. Now, for being the best partner to someone that person must be truly committed to the other person’s success as well as their own while building trust along with mutual respect towards each other’s experience, and working towards long-term collaboration are key (Kraemer, 2015; Shankman et al., 2015). But, trust and belief in oneself are needed to get oneself from a fixed mindset into a growth mindset (Cashman, 2010; Sivers, 2014). Trust is key for a person to be authentic, vulnerable, and personal mastery (Cashman, 2010). Trust in oneself is the first thing that must occur prior to being able and open to trusting others. Trustworthiness attracts other people to believe in and follows their leader (Shankman et al., 2015).

Cashman (2010) and Shankman et al. (2015) state that engendering trust amongst people is by living authentically to oneself and trusting in oneself. To build up trust in oneself Shankman et al. (2015) suggested to: follow through on your commitments and being open and vulnerable to others by exposing your flaws in a positive way.

Important aspects of Emotional Intelligence

There are four aspects of emotional intelligence: self-awareness, self-management, social awareness, and relationship management (Bardberry, Greaves, & Lencioni, 2009; Help Guide, n.d.). It is important to recognize emotions felt and how it leads one to act, which is known as self-awareness (Bardberry, Greaves, & Lencioni, 2009; Goleman, n.d.; Help Guide, n.d.). Patterson, Grenny, McMillan and Switzler (2002), analogized how emotions are formed by talking about emotions as if it were an arrow. The analogy goes that the facts are described as the feathers of the arrow and providing stability to the arrow. Note that some arrows may have many feathers and others don’t, but these feathers are tied to the shaft of the arrow, which helps build a story. This story that is built on the facts, guide us to the point of the arrow, which points in the direction towards the emotions that are felt. Everyone can have different facts to the same scenario, thus would form different stories. Thus different people would react differently emotionally to the same situation.

Therefore, it is important to understand and recognize what emotions are being felt and what are the stories that have led to this emotion (Goleman, n.d.; O’Niel, 1996; Patterson et al., 2002). Remembering to question the facts are a great way to diffuse certain emotional responses to make good life decisions, thus known as self-management (Bardberry et al., 2009; Help Guide, n.d.; O’Niel, 1996; Patterson et al., 2002). O’Niel’s 1996 interview also informed the readers that learning and emotions are strongly connected to the prefrontal cortex. Consequently, if strong emotions are felt and not dealt with, there is little bandwidth to focus on learning. Furthering the need to understand and being in control of one’s emotions. Plus, without self-awareness and self-management one cannot master social awareness and relationship management, because if one cannot understand themselves how that person can seek to understand others or be understood (Bardberry et al., 2009).


  • Bardberry, T., Greaves, J., & Lencioni, P. (2009). Emotional Intelligence 2.0. San Diego: Talent Smart.
  • Cashman, K. (2010) Leadership from the inside out Becoming a leader for life. (2nd ed.). San Francisco, Berrett-Koehler Publishing, Inc.
  • Chapman, B. & Sisodia, R. (2015) Everybody matters: The extraordinary power of caring for your people like family. New York, Penguin.
  • Goleman, D. (n.d.). Emotional Intelligence. Retrieved from
  • Help Guide (n.d.) Improving emotional intelligence (EQ): key skills for managing your emotions and improving your relationships. Retrieved from