SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
15542
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
	{
		if ($nrows > 0) {
			if ($offset <= 0) $str = " ROWS $nrows ";
			else {
				$a = $offset+1;
				$b = $offset+$nrows;
				$str = " ROWS $a TO $b";
			}
		} else {
			// ok, skip
			$a = $offset + 1;
			$str = " ROWS $a TO 999999999"; // 999 million
		}
		$sql .= $str;

		return ($secs2cache) ?
				$this->CacheExecute($secs2cache,$sql,$inputarr)
			:
				$this->Execute($sql,$inputarr);
	}
30857
def p_fromtable(self,t):
    
    if len(t)==6: t[0]=AliasX(t[2],t[5])
    elif len(t)==2: t[0]=t[1]
    else: raise NotImplementedError('unk_len',len(t)) # pragma: no cover
187933
function readTableInfo(tokens, skipSelector) {
	var tableInfo = {};
	tableInfo.winIndex = protocol.decodeInteger(tokens[1]);
	tableInfo.pubModes = protocol.decodePubModes(tokens[3]);
	tableInfo.groupName = protocol.decodeString(tokens[5]);
	tableInfo.schemaName = protocol.decodeString(tokens[7]);
	tableInfo.firstItemIndex = protocol.decodeInteger(tokens[9]);
	tableInfo.lastItemIndex = protocol.decodeInteger(tokens[11]);
	if (!skipSelector)
		tableInfo.selector = protocol.decodeString(tokens[13]);
	return tableInfo;
}
431469
def sample(self, num):
        
        if num > len(self):
            return self.copy()
        elif num < 0:
            raise IndexError("Cannot sample a negative number of rows "
                             "from a DataTable")

        random_row_mask = ([True] * num) + ([False] * (len(self) - num))
        shuffle(random_row_mask)

        sampled_table = self.mask(random_row_mask)
        random_col_name = 'random_sorting_column'
        while random_col_name in sampled_table:
            random_col_name = '%030x' % randrange(16**30)
        sampled_table[random_col_name] = [random()
                                          for _ in xrange(len(sampled_table))]
        sampled_table.sort(random_col_name, inplace=True)
        del sampled_table[random_col_name]
        return sampled_table
1268917
def _skip_lines(self, n):
        ''''''
        for i in range(n):
            self.line = next(self.output)
        return self.line
618205
def skip(self, steps=1):
        """"""
        for _ in six.moves.range(steps):
            self.next_token()
71391
def selecteq(table, field, value, complement=False):
    """"""

    return selectop(table, field, value, operator.eq, complement=complement)
185509
public static String[] getSelectColumns(String sql) {
		Asserts.notBlank(sql);
		sql = sql.trim();
		if (sql.startsWith("select ") || sql.startsWith("SELECT ")) {
			sql = sql.substring(7).trim();
			int idxFrom = sql.indexOf(" from ");
			if (idxFrom == -1)
				idxFrom = sql.indexOf(" FROM ");
			if (idxFrom == -1)
				throw new IllegalArgumentException("Bad sql, no from ");
			sql = sql.substring(0, idxFrom).trim();
			String[] columns = sql.split(",");
			for (int i = 0; i < columns.length; i++) {
				columns[i] = columns[i].trim();
			}
			return columns;
		} else {
			throw new IllegalArgumentException("Not a select sql");
		}
	}
688400
def selectisnot(table, field, value, complement=False):
    """"""

    return selectop(table, field, value, operator.is_not, complement=complement)
1297372
def selectnone(table, field, complement=False):
    """"""

    return select(table, field, lambda v: v is None, complement=complement)
365485
def select_random(engine, table_or_columns, limit=5):
    
    s = select(table_or_columns).order_by(func.random()).limit(limit)
    return engine.execute(s).fetchall()
810039
def fetchone(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    return select(table, cols, where, group, order, limit, **kwargs).fetchone()
321993
def select_number(self, rows: List[Row], column: NumberColumn) -> Number:
        
        numbers: List[float] = []
        for row in rows:
            cell_value = row.values[column.name]
            if isinstance(cell_value, float):
                numbers.append(cell_value)

        return numbers[0] if numbers else -1
308987
def select_distinct(self, table, cols='*', execute=True):
        """"""
        return self.select(table, cols, execute, select_type='SELECT DISTINCT')
444326
def skip(num):
    """"""
    click.echo("Current problem is problem %i." % num)
    generate(num + 1, prompt_default=False)
    Problem(num).file.change_suffix('-skipped')
532869
def remove_column(table, remove_index):
        '''
        
        '''
        for row_index in range(len(table)):
            old_row = table[row_index]
            new_row = []
            for column_index in range(len(old_row)):
                if column_index != remove_index:
                    new_row.append(old_row[column_index])
            table[row_index] = new_row
        return table
1254037
def _select_batched(self, table, cols, num_rows, limit, queries_per_batch=3, execute=True):
        """"""
        # Execute select queries in small batches to avoid connection timeout
        commands, offset = [], 0
        while num_rows > 0:
            # Use number of rows as limit if num_rows < limit
            _limit = min(limit, num_rows)

            # Execute select_limit query
            commands.append(self._select_limit_statement(table, cols=cols, offset=offset, limit=limit))
            offset += _limit
            num_rows += -_limit

        # Execute commands
        if execute:
            rows = []
            til_reconnect = queries_per_batch
            for c in commands:
                if til_reconnect == 0:
                    self.disconnect()
                    self.reconnect()
                    til_reconnect = queries_per_batch
                rows.extend(self.fetch(c, False))
                til_reconnect += -1
            del commands
            return rows
        # Return commands
        else:
            return commands