zoukankan      html  css  js  c++  java
  • 2017-12-27练习

    一、shell练习题

     1.设定变量FILE的值为/etc/passwd
     2.依次向/etc/passwd中的每个用户问好,并且说出对方的ID是什么
            形如:(提示:LINE=`wc -l /etc/passwd | cut -d" " -f1`)
            Hello,root,your UID is 0.
     3.统计一共有多少个用户

    #!/bin/bash
    file="/etc/passwd"
    LINES=`wc -l $file | cut -d " " -f1`
    for I in `seq 1 $LINES` ;do
    userid=`head -$I $file |tail -1 |cut -d : -f3`
    username=`head -$I $file |tail -1 |cut -d : -f1`
    echo "hello $username,your UID is $userid"
    done
    echo "there are $LINES users"

    二、sql练习题

    学生表

    Student(Sno,Sname,Sage,Ssex)学生表
    Sno:学号
    Sname:学生姓名
    Sage:学生年龄
    Ssex:学生性别

    课程表

    Course(Cno,Cname,Tno)课程表
    Cno:课程编号
    Cname:课程名称
    Tno:教师编号

    成绩表

    SC(Sno,Cno,score)成绩表
    Sno:学号
    Cno:课程编号
    score:成绩

    教师表

    Teacher(Tno,Tname)教师表
    Tno:教师编号:
    Tname:教师名字

    1、查询“001”课程比“002”课程成绩高的所有学生的学号

    SELECT a.Sno from (SELECT Sno,score from sc where Cno = 'C01') a ,(SELECT Sno,score from sc where Cno = 'C02') b WHERE a.score > b.score and a.Sno = b.sno ;
  • 相关阅读:
    cmake使用
    CMake...
    信息熵相关知识总结
    最强NLP模型-BERT
    问答系统总结
    检索问答模型
    文本分类-TextCNN
    机器学习-Logistic回归
    Attention注意力机制介绍
    机器学习-聚类Clustering
  • 原文地址:https://www.cnblogs.com/fulucky/p/8126032.html
Copyright © 2011-2022 走看看